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/master/modules/video/src/optflowgf.cpp, 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.