bi-aidetection icon indicating copy to clipboard operation
bi-aidetection copied to clipboard

Support Object Tracking

Open doudar opened this issue 4 years ago • 5 comments

I think that with the dynamic mask stuff you guys are working on, it would also be possible to use that same information to enable smart object tracking with a PTZ camera. Exciting Stuff!

doudar avatar Aug 26 '20 17:08 doudar

Hmm seems like this should be an option directly in BI... but according to blueiris.pdf, it maybe can be done externally?

"/admin?camera=x&ptz=n PTZ command n on camera x (short name). n=0,1... for left,right,up,down,center,zoom+,zoom-"

VorlonCD avatar Aug 26 '20 18:08 VorlonCD

Just below that is also:

/cam/{cam-short-name}/pos=x Performs a PTZ command on the specified camera, where x=
0=left, 1=right, 2=up, 3=down, 4=home, 5=zoom in, 6=zoom out 

It would be nice if there was an option to specify the step size but I guess you're left to the camera default. Which isn't horrible.

doudar avatar Aug 26 '20 18:08 doudar

Sorry for the suggestion of this feature creep, but this would be a killer app for extremely cheap PTZ cameras like the Amcrest ProHD.

doudar avatar Aug 26 '20 18:08 doudar

I'm seriously considering renaming my username to 'FeatureCreep' :) So how would this work? Lets say a detection was at lower left of camera. How do I know how many downs and lefts to take to make the detection in the center? And how to revert back to original location?

VorlonCD avatar Aug 26 '20 19:08 VorlonCD

Well, returning to the original location is easy. If the object is no longer detected or hasn't moved in X number of snapshots, return to home position: /cam/{cam-short-name}/pos=4

For tracking I'd recommend percentage. Calculate the objects 2D percentage from center. Always start with (in your example) one down and one left if it's outside the defined center deadzone. (analyze another snapshot). Then recalculate the percentage from center and compare it to the original percentage from center. Then apply an approximated number of movements as a function of the percentage delta (using a minimum of 0 and a maximum of (user defined).

i.e. Object was originally 20%down & 10%left. Now is 10%down and 0%left so apply 1 Down and 0 Left movements. or i.e. Object was actually further away from center (because it moved), so apply (max) movements.

If you have to switch direction (object was left of center. is now right of center((&outside of dead zone)), revert back to 1 movement.

It sounds so easy it's basically writing its-self! 😅 🤣🤣🤣

doudar avatar Aug 26 '20 19:08 doudar