normalized cross correlation;cros correlation problem!!

조회 수: 2 (최근 30일)
mehmet Söyler
mehmet Söyler 2013년 2월 19일
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
Shashank Prasanna
Shashank Prasanna 2013년 2월 19일
Can you use the '{} code' button in order to format your code. It is extremely unreadable.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by