# Exhaustive Block Matching Algorithm

32 views (last 30 days)
Tuan Nguyen on 1 Feb 2012
Commented: Walter Roberson on 22 Nov 2017
Hi all,
I'm trying to write the Exhaustive Block Matching Algorithm based on the pseudo-code written in this slide: http://inst.eecs.berkeley.edu/~ee290t/sp04/lectures/motion_estimation.pdf
I think I wrote my programme not correctly but don't know where I was wrong. Can anyone please help me? Thank you very much :(

#### 1 Comment

Jan on 1 Feb 2012
It is very likely, that someone is assisting to solve the problems if you post the corresponding code and explain, what's going wrong. Currently the best answer is: "yes".

Walter Roberson on 1 Feb 2012
On one of the lines, you have a typing mistake.

#### 1 Comment

Tuan Nguyen on 7 Feb 2012
I'm sorry about that since my English is not so good.

Tuan Nguyen on 7 Feb 2012
Oh I'm so sorry for forgetting posting my code. This is my matlab code written for exhaustive block matching algorithm
function motionVect = motionEst(f1,f2,N,R)
[height width] = size(f2);
figure,imshow(f2);
hold on;
for i = 1:N:height-N
for j = 1:N:width-N
mvx = 0;
mvy = 0;
for k = -R:1:R
for l = -R:1:R
for u = i:i+N-1
for v = j:j+N-1
if ((u+k > 0)&&(u+k < height + 1)&&(v+l > 0)&&(v+l < width + 1))
end
end
end
dy = k;
dx = l;
end
end
end
iblk = floor((i-1)/(N+1))+1;
jblk = floor((j-1)/(N+1))+1;
mvx(iblk,jblk) = dx;
mvy(iblk,jblk) = dy;
%figure, imshow(f2);
%hold on;
arrow([i j],[i+dy j+dx], 3);
end
end
And this is the pseudo-code on which I based to write my code
I have a doubt that there might be something wrong with the lines in my code which calculate MAD but I'm not so sure about that.
Thanks very much.

Neda Azarmehr on 14 May 2017
Hi
I am wondering what is N, R, and K on this code. Could anyone help me about it?
Regards, Neda
Walter Roberson on 14 May 2017
N is the block size. R is the search range. K is the current search location.
Felipe Ayres on 16 Nov 2017
aren't dy and dx switched?

beppo on 22 Nov 2017
Hi, what is the arrow function at the very bottom? Also, is the code working or not? Thanks

#### 1 Comment

Walter Roberson on 22 Nov 2017