i am having code related to image processing for local motion vector estimation using block matching.how to show motion vector using quiver or any other function?? I am using matlab 7.10.0(R2010a),
3 views (last 30 days)
Show older comments
*
%Function for estimating the MSE noise in an image sequence.
function [noisemse] = mvnoise(Y1, Y2, bsize);
psize = size(Y1);
Bsize = psize/bsize;
msev = [];
MV = zeros([Bsize 2]);
for curr_y = 1:bsize:psize(1)
for curr_x = 1:bsize:psize(2)
curr_block = Y2(curr_y + [0:(bsize-1)], curr_x + [0:(bsize-1)]);
zero_block = Y1(curr_y + [0:(bsize-1)], curr_x + [0:(bsize-1)]);
zero_error = sum((curr_block(:) - zero_block(:)).^2);
min_error = zero_error;
best_mv = [0 0];
min_y = max(curr_y - bsize + 1, 1);
max_y = min(curr_y + bsize - 1, psize(1) - bsize + 1);
min_x = max(curr_x - bsize + 1, 1);
max_x = min(curr_x + bsize - 1, psize(2) - bsize + 1);
for prev_y = min_y:max_y
for prev_x = min_x:max_x
if ((prev_y ~= curr_y) & (prev_x ~= curr_x))
prev_block = Y1(prev_y + [0:(bsize-1)], prev_x + [0:(bsize-
1)]);
curr_error = sum((curr_block(:) - prev_block(:)).^2);
if (curr_error < min_error)
best_mv = [curr_y - prev_y, curr_x - prev_x];
min_error = curr_error;
end
end
end
end
if (best_mv == [0 0])
msev = [msev, min_error];
end
MV(ceil(curr_y/bsize), ceil(curr_x/bsize), :) = best_mv;
end
end
save noiseresults msev;
noisemse = mean(msev) + 3*std(msev);*
0 Comments
Answers (0)
See Also
Categories
Find more on Custom Libraries in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!