Matlab OpticalFlowLK algorithm doesn't stick to the paper

65 Views Asked by At

I am trying to implement Lucas Kanade algorithm and I followed a descripion in Matlab documentation -> Algorithm. This algorithm should relate to this paper.

It looks like there are several misleading point that doesn't relate accordingly to the paper:

Matlab quote:

  1. Smooth the gradient components, Ix, Iy, and It, using a separable and isotropic 5-by-5 element kernel whose effective 1-D coefficients are [1 4 6 4 1]/16.

Paper Page 6 quote:

Our implementation first smooths the image sequence with a spatiotemporal Gaussian filter with a std of 1.5pixels-frames. [...] Derivatives were computed with 4-point central differences with mask coeffs (-1, 8, 0, -8, 1)/12. Spatial neighbourhoods were 5x5 pixels, and the window function W² was separable and isotropic; its effective 1-D weights are (1, 4, 6, 4, 1)/16.

It seems that they use the isotropic kernel to smooth Ix, Iy, It with a convolution. However in paper they use this kernel as 'function' window W² instead:

  • Paper : $\sum_{\Omega}{W²(x)I_x²(x)}$ is different to:

  • Matlab : $\sum_{\Omega}{I_g²(x)}$ with $I_g=I_x * W$

To my mind it has different outcome and you can't factorize this window as a convolution in preprocessing.

When you sum through your neighbourhood ($\Omega$) every neighbour would be affected by W filter centered in that particular neighbour. Except that it should be only one filter per $\Omega$. There is no notion of distance from the center of $\Omega$ anymore.

Can you give me feedback if there is something wrong or not ?