Calcopticalflowpyrlk function in opencv 3.0

asked 2016-08-14 10:54:17 -0600

I'm trying to track something in some frames. I know calcopticalflowpyrlk(http://docs.opencv.org/3.0-beta/modules/video/doc/motion_analysis_and_object_tracking.html) is supposed to be used for sparse tracking problems. However, I thought it wouldn't really hurt if I just try to track all pixels in the frames.

So my video frames are actually very stable(motions are barely visible by eyes), and calcopticalflowpyrlk works well for most pixels. But for some pixels it returns really big flow vectors(like [200,300]), which doesn't make sense.

And I also found a Matlab implementation that's using the same Pyramidal Lucas-Kanade algorithm, but this Matlab version doesn't return any crazy values.

So I'm wondering what is causing opencv function to return huge non-reasonable values. Is it because the matrix inversion is done differently?

edit retag flag offensive close merge delete

Comments

Can you give code example and two iimages in post ?

LBerger gravatar imageLBerger ( 2016-08-14 14:38:07 -0600 )edit

There should be a status vector that tells if a point is correctly track or not. The algorithm should fail with points that are on textureless locations.

Can you add the link to the Matlab implementation?

Eduardo gravatar imageEduardo ( 2016-08-15 17:46:00 -0600 )edit