Pattern Finding in Images using Cross Correlation
clc
clear all
close all
a=imread('Capture1.JPG');
at=rgb2gray(a);
figure;
imshow(a);
title('Original
Image');
bt=imread('Capture2.JPG');
b=rgb2gray(bt);
figure;
imshow(bt);
title('Pattern');
cross=normxcorr2(b,at);
[y
x]=find(cross>=0.98*max(cross(:)));
ynew=y-size(b,1);
xnew=x-size(b,2);
figure;
imshow(a);
for i=1:length(xnew)
imrect(gca,[xnew(i)+1,ynew(i)+1,size(b,2),size(b,1)]);
hold on;
end
title('Found
Patterns');
Live Support: https://www.t.me/matlabcastor
Share with us: https://www.quora.com/q/matlabirawen
Free Codes: https://www.youtube.com/castorclasses
Free Support: https://www.castorclasses2014@gmail.com
Like us: https://www.facebook.com/matlabirawen/
Join us: https://www.facebook.com/groups/MATLA...
MATLAB Book for the beginner: https://amzn.to/3fTfmTa
Free program: https://www.matlabcoding.com
No comments