Indexing error.How out of bound elements in case of indexing error occurs can be replaced by zeros(or by interpolation)
1 view (last 30 days)
Show older comments
Hey guys could u help me out to solve this indexing error.I want when indexing error occurs in this the out of bound elemnts should be replaced by zeros(or by interpolation
frame1=rand(200,25)
wsizeR=4
wsizeC=4
wsizeR2=4
wsizeC2=4
wshiftR=2
wshiftC=2
[row,col]=size(frame1);
num_dispR = fix((row - max([wsizeR wsizeR2]) + wshiftR)/wshiftR);
num_dispC = fix((col - max([wsizeC wsizeC2]) + wshiftC)/wshiftC);
prevR=3.*ones(num_dispR)
prevC=2.*ones(num_dispC)
for k=1:num_dispR-3
for l=1:num_dispC-2
locR = (k-1)*wshiftR+1;
locC = (l-1)*wshiftC+1;
tmp1 = frame1(locR:locR+wsizeR-1,locC:locC+wsizeC-1)
tmp2 = frame1(locR+prevR(k,l):locR+wsizeR2-1+prevR(k,l),locC+prevC(k,l):locC+wsizeC2+prevC(k,l)-1)
end
end)
0 Comments
Answers (0)
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!