normalized cross correlation;cros correlation problem!!

1 次查看(过去 30 天)
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

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by