I have a function which aimed to crop a part of image and find that cropped part inside main picture by using conv2
.As far as I know when using convolution on two matrix the coordinates of maximum value in resulted matrix show similar parts of matrices.
My problem is that x,y doesn't show the true point.
function [ ] = cropImage( fileIn)
im=imread(fileIn);
[r c]=size(im);
crop=imcrop(im);
figure(1)
subplot(2,2,1)
imshow(im)
subplot(2,2,2)
imshow(crop)
d=conv2(double(im),double(crop);
m=max(d);
m=max(m);
[x y]=find(d==m);
subplot(2,2,4)
imshow(d)
text(x,y,'+','color','r');
subplot(2,2,1)
text(x,y,'+','color','r');
end