Farneback’s opticalflow implementation bug?

asked 2015-11-20 02:21:39 -0500

lowlander256 gravatar image

I'm following papers regarding the Gunnar Farneback’s opticalflow algorithm and its OpenCV implementation. Meanwhile, I found a suspicious calculation in the code.

The calculation is at line 288-289 in https://github.com/Itseez/opencv/blob..., and the code is here:

r2 += r4*dy + r6*dx;
r3 += r6*dy + r5*dx;

Reading the surrounding lines, the above code is seemed to be the calculation of the 2nd term of the formula (7.33), A(x)d(x), in [Farneback2002].

However, if my understanding is correct, the calculation should be the following:

r2 += r4*dx + r6*dy;
r3 += r6*dx + r5*dy;

Is my understanding wrong?

[Farneback2002] Gunnar Farneback, Polynomial Expansion for Orientation and Motion Estimation.

edit retag flag offensive close merge delete



If you have a test ready (I think Middlebury tests are available) then you could run it both ways and see which generates results closer to ground truth. Not perfect and not the same as understanding, but perhaps worthwhile.

Der Luftmensch gravatar imageDer Luftmensch ( 2015-11-20 07:13:21 -0500 )edit

I'd like to know if this implementation is intended or not. Nevertheless the test generates closer results, if the implementation has an unintended code then it is a bug. If it is intended, I want to know its intention.

lowlander256 gravatar imagelowlander256 ( 2015-11-25 00:40:02 -0500 )edit