calcOpticalFlowPyrLK doesn't respect window size? [bug ?]
I am trying to use optical flow with opencv 2.4.5: calcOpticalFlowPyrLK()
I am using similar parameters to the demo of the opencv:
Size winSize(6,6); // Small window size
calcOpticalFlowPyrLK(
prevFrame, currentFrame, points[0], points[1],
status, err, winSize,
0, termcrit, 0, 0.001 // Only the input image
);
But as you can see I have set the maxLevels to 0 (so it will process only the current layer).
The problem is that this function sometimes returns a distance between points of over 100, if I do:
for(int i=0;i<points[1].size();i++) {
if( !status[i] ) {
continue;
}
cout << points[1][i] - points[0][i] << endl;
}
This sometime prints:
(53,120)
Meaning that y has a difference of over 120 pixels. Is that normal with a window size of only (6,6)? Note that this happens even if i give more layers in the pyramid.
Note that this happens especially when a point gets occluded or goes out of the scene