Back to Browse

Template Matching using Cross Correlation Indepth Intuition

5.8K views
Jun 7, 2021
19:14

Code used in this video: clc clear all close all warning off a=[1 1 1 1 1 1; 1 20 2 2 2 1; 1 2 3 3 2 1; 1 2 3 3 2 1; 1 2 2 2 2 1; 1 1 1 1 1 1]; w1=[3 3 2; 3 3 2; 2 2 2]; newA = zeros(size(a)+2); newA(2:end-1,2:end-1)=a; a=newA; [row col]=size(a); a1=zeros(row,col); for x=2:1:row-1 for y=2:1:col-1 a1(x,y)=w1(1)*a(x-1,y-1)+w1(2)*a(x-1,y)+w1(3)*... a(x-1,y+1)+w1(4)*a(x,y-1)+w1(5)*a(x,y)+w1(6)*... a(x,y+1)+w1(7)*a(x+1,y-1)+w1(8)*a(x+1,y)+w1(9)*... a(x+1,y+1); end end aa1=a1(2:end-1,2:end-1); %Normalised Version a2=zeros(row,col); for x=2:1:row-1 for y=2:1:col-1 a2(x,y)=w1(1)*a(x-1,y-1)+w1(2)*a(x-1,y)+w1(3)*... a(x-1,y+1)+w1(4)*a(x,y-1)+w1(5)*a(x,y)+w1(6)*... a(x,y+1)+w1(7)*a(x+1,y-1)+w1(8)*a(x+1,y)+w1(9)*... a(x+1,y+1); values=[a(x-1,y-1) a(x-1,y) a(x-1,y+1) a(x,y-1)... a(x,y) a(x,y+1) a(x+1,y-1) a(x+1,y) a(x+1,y+1)]; normalisation_value=sqrt(sum(values.^2)); a2(x,y)=a2(x,y)/normalisation_value; end end aa2=a2(2:end-1,2:end-1); Practical Implementation: Demo: Pattern Finding in Images using Cross Correlation https://youtu.be/VIGbDvAd2i4 Detail Explanation: Pattern Finding in Image using Cross Correlation | MATLAB https://www.youtube.com/watch?v=hwWUOh7yKbI Learn Complete Machine Learning & Data Science using MATLAB: https://www.youtube.com/playlist?list=PLjfRmoYoxpNoaZmR2OTVrh-72YzLZBlJ2 Learn Digital Signal Processing using MATLAB: https://www.youtube.com/playlist?list=PLjfRmoYoxpNr3w6baU91ZM6QL0obULPig Learn Complete Image Processing & Computer Vision using MATLAB: https://www.youtube.com/playlist?list=PLjfRmoYoxpNostbIaNSpzJr06mDb6qAJ0 🙏🙏🙏🙏🙏🙏🙏🙏 YOU JUST NEED TO DO 3 THINGS to support my channel LIKE SHARE & SUBSCRIBE TO MY YOUTUBE CHANNEL #DigitalImageProcessing #MATLAB #ComputerVision

Download

0 formats

No download links available.

Template Matching using Cross Correlation Indepth Intuition | NatokHD