SAD with full search range [-6,6]
9 views (last 30 days)
Show older comments
I have an image divided in 16x16 macroblocks and another image 144x176 and I want to calculate SAD for each macroblock in range of [-6,6] for vectors (i,j) using full search
lets assume m=144 and n=176 so my macroblocks cell has dimensions 144/16 176/16 = 9x11 I want to take the sum of absolute differences from each macroblock and the 144x176 image. The problem is that I go out of limits of my image array or I go till the end of the rows and columns instead I only need the values that are +-6.
Any idea ?
for i =1:1:9 %i take each 16x16 macroblock
for j =1:1:11
for k=6:1:m
for l=6:1:n
kl=kl+sum(abs(macroblocks{i,j} - image(k-5:k+5,l-5:l+5)));
end
end
end
end
0 Comments
Answers (1)
Image Analyst
on 28 Nov 2019
Try blockproc(). I attach demos where I use it for other functions.
5 Comments
Image Analyst
on 28 Nov 2019
OK, so do it with for loops but I think it will make the computation of the row and column indexes easier if you use imresize() to make them the same size.
See Also
Categories
Find more on Matrix Indexing 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!