Closed gfugante closed 10 months ago
Hi @aguscas! I tried to use the motion estimation a lot more and I found out that it breaks very easily even with the previous fix. Have a look at the new one! It's much more stable as it handles better the _get_sparse_flow
function and the transformations_getter
: on the second one the new handling is pretty strong, as I delete it and reinstantiate a copy, this has worked very well even in my usage code, where I delete the MotionEstimator
when it break to instantiate a new one.
Anyways, the code is now stable even when you cover the camera, wave in front of it or have a mask that covers the entire frame. As said this is the best solution I found, it actually took a long time to get it and if you can break it please let me know how, also because touching these logics got me to Nan
distances, and consequently to a very hard exit()
in tracker.py
, which is game over for the user.
Hi @aguscas! Did you have any time to look or test this?
When estimating the motion transformation with the following code:
where
frame
can be any captured RGB frame andmotion_estimation_mask
is a mask representing all the bounding box of the people detected in theframe
, the following two errors are sometimes raised:and:
This becomes increasingly frequent when there are lots of detections, making the tracker unusable.
The issue can be easily reproduced by istantiating the motion estimator as
MotionEstimator(max_points=3)
, as thecv2.findHomography
needs at least 4 points.