Optical Flow Horn-Schunck Algorithm BFB kernel

I have created an artificial image with an object moving one pixel left and one pixel up with each frame. I currently calculate my derivates in the following manner:
Ix = conv2(im0,0.25* [-1 1; -1 1],'same') + conv2(im1, 0.25*[-1 1; -1 1],'same');
Iy = conv2(im0, 0.25*[-1 -1; 1 1], 'same') + conv2(im1, 0.25*[-1 -1; 1 1], 'same');
It = conv2(im0, 0.25*ones(2),'same') + conv2(im1, -0.25*ones(2),'same');
I have tried to implement a BFB kernel, and my results seem to be less accurate. Any pointers in the right direction would be great.
BFB_kernel = (1/12)*[-1 8 0 -8 1];
Ix=conv2(im0,BFB_kernel, 'same');
Iy=conv2(im0,BFB_kernel', 'same');
It = conv2(imneg2, (-1/12)*ones(1),'same') + conv2(imneg1, (8/12)*ones(1),'same')+ conv2(im1, -(8/12)*ones(1), 'same') + conv2(im2, (1/12)*ones(1),'same');
Ix=-Ix;Iy=-Iy;
I have attached two images with the standard kernel and BFB kernel.
Many thanks,
Yasha

Respuestas (0)

Preguntada:

el 2 de Dic. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by