Lesson 5: Filters as templates
1D correlation
Onion = rgb2gray(imread(‘onion.png’));
Peppers = rgb2gray(imread(‘pepper.png));
imshowpair(peppers, onion, ‘montage’);
C = normxcorr2(onion, peppers);
Figure, surf(c), shading flat;
Positive lays positive, negative line up with the negatives.
Spike => where the two images syncs
Function index = find_template_1D(t,s)
C = normxcorr2(t,s);
[maxValue index] = max(c);
Index = rawIndex - size(t,2) +1;
Endfunction