I’m working on a problem where I need to estimate the velocity of objects in a scene. The camera is static, and the objects move strictly perpendicular to the camera, so optical flow seems like a good way to achieve this.
I’ve run some tests using the lktrack.py from the latest opencv version from Github (samples/python/lktrack.py).
It seems like lktrack performs very well on relatively slow-moving objects in the scene, reliably detecting corners and creating tracks. Here’s an example.
Once the movement is sped up, however, it completely fails to consistently detect corners and create the tracks. You can see an example of this here.
I’ve played with both the lktrack parameters as well as the goodfeaturestotrack() parameters with no improvement. When applying a binary threshold to the video, the lktrack example actually works for the fast-moving example. This suggests that goodfeaturestotrack() somehow struggles to detect fast-moving features unless the contrast is very high. I’m confused by this because the videos I’m using as input are computer generated and contain no motion blur. I would therefore assume that corner detection should work equally well, whether the object moves fast or slow.
The other odd behavior is that the images is filled up with tracking points that don’t actually move.
Any suggestions on how to improve the performance of lktrack for fast movment would be highly appreciated.