![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172359/image.jpeg)
hi i am doing this assignment and i have no idea what does that mean or asking me to do?
1 view (last 30 days)
Show older comments
When using correlation to detect objects in images, it may be that the size of the image represented by the search object does not match the size of the object in the image we are searching. To solve this problem, we can perform multi-scale analysis. Using the affine transform function imresize (used in Lecture/Tutorial 05) search the image searchSpace.bmp for the object contained in image mask searchObject.bmp. We will try with the mask at 1/4, 1/2, 1, 2, 3, and 4 times its loaded size. Keep track of the highest correlation every seen by checking the r value (retuned by corr2) at each location as we go along (for each image position and mask scale) and recording the value and location of the highest value for plotting at the end. Alternatively, you might calculate the Mean Square Error (MSE) between each image region and that object (mask) we are searching for.
0 Comments
Answers (1)
Image Analyst
on 16 Dec 2015
Correlation is not robust to finding pattern. Normalized cross correlation is much better. I have a demo for that. Just run the attached demo in a loop where you do it 6 times, calling resize for each of the requested new sizes.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172359/image.jpeg)
2 Comments
Image Analyst
on 16 Dec 2015
It's asking you to resize the searchObject at each iteration.
searchObject = imread('searchObject.bmp');
searchSpace = imread('searchSpace.bmp');
s = [1/4, 1/2, 1, 2, 3, 4]
for k = 1 : length(s)
searchSpaceResized = imresize(searchSpace, s(k));
out = normxcorr2(searchObject, searchSpaceResized);
imshow(out, []);
% Now do something with out.
end
I know they said something about corr2(), but the help says the two arrays must be the same size: "r = corr2(A,B) returns the correlation coefficient r between A and B, where A and B are matrices or vectors of the same size." normxcorr2() has no such limitations. I'd just take the mean value of out as a measure of the average correlation over the whole image.
You can use immse() which is the other suggestion/hint given by your question, but the images must be the same size.
See Also
Categories
Find more on Geometric Transformation and Image Registration 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!