normalized cross correlation;cros correlation problem!!
1 view (last 30 days)
Show older comments
I did a correlation of two different picture. I have found the same correlation with the two different objects in the picture. but it did not object to my trimmed. I shared a picture for it. What is the reason for this? I have used the following commands. > rgbImage = imread('d:/b1.jpg'); >> subplot(3, 3, 1); >> imshow(rgbImage, []); >> axis on; >> smallSubImage = imcrop(rgbImage, [55 325 80 104]); >> subplot(3, 3, 2); >> imshow(smallSubImage, []); >> axis on; >> correlationOutput = normxcorr2(smallSubImage(:,:,1), rgbImage(:,:,1)); >> subplot(3, 3, 3); >> imshow(correlationOutput, []); >> subplot(3, 3, 4); >> [maxCorrValue, maxIndex] = max(abs(correlationOutput(:))); >> [ypeak, xpeak] = ind2sub(size(correlationOutput),maxIndex(1)); >> corr_offset = [(xpeak-size(smallSubImage,2)) (ypeak-size(smallSubImage,1))]; >> subplot(3, 3, 4); >> imshow(rgbImage); >> hold on; >> rectangle('position',[corr_offset(1) corr_offset(2) 50 50],... 'edgecolor','g','linewidth',2); >> >> rgbImage = imread('d:/b2.jpg'); >> subplot(3, 3, 5); >> rgbImage1 = imread('d:/b2.jpg'); >> imshow(rgbImage1, []); >> axis on; >> correlationOutput = normxcorr2(smallSubImage(:,:,1), rgbImage1(:,:,1)); >> subplot(3, 3, 6); >> correlationOutput2 = normxcorr2(smallSubImage(:,:,1), rgbImage1(:,:,1)); >> imshow(correlationOutput2, []); >> [maxCorrValue, maxIndex] = max(abs(correlationOutput2(:))); >> [ypeak, xpeak] = ind2sub(size(correlationOutput2),maxIndex(1)); >> corr_offset = [(xpeak-size(smallSubImage,2)) (ypeak-size(smallSubImage,1))]; >> subplot(3, 3, 7); >> imshow(rgbImage1); >> hold on; >> rectangle('position',[corr_offset(1) corr_offset(2) 50 50],... 'edgecolor','g','linewidth',2); Where is my fault?.. http://img856.imageshack.us/img856/5973/memog.jpg
1 Comment
Shashank Prasanna
on 19 Feb 2013
Can you use the '{} code' button in order to format your code. It is extremely unreadable.
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!