getting an error ??? Subscript indices must either be real positive integers or logicals.
Show older comments
I run this code and i get the error at line 14 (at MAD=....)
function [fp,mvx,mvy]=vp_ipebma(f1,f2,N,R)
%f1: anchor frame; f2: target frame, fp: predicted image;
%mvx %mvx mvy: store the MV image ,mvy: store the MV image
%widthxheight: image size; N: block size (16 here), R: search range
height=352;
width=288;
i=0;
for i=N:N:height-N,
for j=N:N:width-N %for every block in the anchor frame
MAD_min=256*N*N;mvx=0;mvy=0;
for k=-R:1:R,
for l=-R:1:R %for every search candidate
MAD=sum(sum(abs(f1(i:i+N-1,j:j+N-1)-f2(i+k:i+k+N-1,j+l:j+l+N-1))));
%%calculate MAD for this candidate calculate MAD for this candidate
if MAD<MAD_min
MAD_min=MAD;
dy=k;
dx=l;
end
end
end
fp(i:i+N-1,j:j+N-1)= f2(i+dy:i+dy+N-1,j+dx:j+dx+N-1);
%put the best matching block in the predicted image
iblk=(floor)*(i-1)/N+1;
jblk=(floor)*(j-1)/N+1;
%block index
mvx(iblk,jblk)=dx;
mvy(iblk,jblk)=dy;
%record the estimated MV
end
end
imshow(uint8(fp));
Answers (0)
Categories
Find more on Neighborhood and Block Processing 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!