Now I want to match these 2 templates with image "I" and identify the matching locations in the image "I".
Please some one send me the MATLAB code for this. Because I'm not familiar with the this section.
-------------------------------------------------------------------------------------------------------
I'm not sure how long it will take, but if your templates are in the
image (i.e. the version of the template in the image is not scaled or
rotated) you can use the xcorr2() function in the Signal Processing
Toolbox to do a cross correlation of the images. This is a simple one-
liner solution - actually a little more because you'd have to search
the resulting array for the max using the find() function or similar
alternate ways. If you don't have that toolbox, you can easily write
it yourself in a few lines (4 nested for loops in the spatial domain).
C = real(ifft2(fft2(someblobsI) .* fft2(rot90(Icropped,2),480,640)));
figure, imshow(C,[]);
max(C(:))
thresh = 1000 ; % Use a threshold that's a little less than max.
figure, imshow(C > thresh); % identification
regards
Prasanna