Segmentation. (template) matching
Transcript of Segmentation. (template) matching
![Page 1: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/1.jpg)
1
Segmentation. (template) matching
![Page 2: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/2.jpg)
2
Reading
6.4Adelson and Bergen, Image Pyramids
![Page 3: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/3.jpg)
3
Template matching
Assumes you know what you are looking for (supervised process)
![Page 4: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/4.jpg)
4
Overall strategy
For every possible position, rotation, or other geometric transformation, compare each pixel’s neighborhood to a template.After computing the strength of the match for each possibility, select the largest one, the largest n, or all that exceed a predefined threshold.
![Page 5: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/5.jpg)
5
Comparing neighborhoods to templates
By linear filtering
( ) ∑ ∑−= −=
++=•=2
2
2
2
),(),(,
m
mh
m
mk
c kjhiEkhAEAjiE
Correlation can be considered as a dot product between two vectors:
-the pattern and the considered image region.
-The dot product is maximal (maximum correlation) when the pattern is very similar to the corresponding image region.
![Page 6: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/6.jpg)
6
Optimality matching criterion evaluation
![Page 7: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/7.jpg)
7
Challenge
We need scaled representations because the details of interest can occur at various scales
![Page 8: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/8.jpg)
8
A bar in the big images is a hair on the zebra’s nose; in smaller images, a stripe; in the smallest, the animal’s nose
![Page 9: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/9.jpg)
9
AliasingCan’t shrink an image by taking every second pixelIf we do, characteristic errors appear
![Page 10: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/10.jpg)
10
![Page 11: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/11.jpg)
11
Detecting a target pattern
The target pattern may appear at any scaleWe want to use only convolutions
Construct copies of the target at several expanded scales, and convolve them with the original image
![Page 12: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/12.jpg)
12
Detecting a target pattern (cont’d)
Or maintain a fixed scale of the target and change the scale of the image
![Page 13: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/13.jpg)
13
Detecting a target pattern
Both approaches should give equivalent resultsThe difference is in the computational complexityA convolution with the target pattern expanded in scale by a factor s requires s2
more operations than the convolution with the image reduced in scale by s. s=2..32 A series of images at iteratively reduced scales will form a pyramid.
![Page 14: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/14.jpg)
14
A Gaussian Pyramid
![Page 15: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/15.jpg)
15
Levels of the Gaussian pyramid expanded to the size of the original image
![Page 16: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/16.jpg)
16
How to construct a Gaussian pyramid
At each iteration:Filtering with a low-pass filter (ex: Gaussian with constant σ or other)Subsampling
( ) ( ) ( )nimiGnmwjiG lm n
l ++= −∑∑ 2,2,, 1
( )nmw , form the correlation kernel. The same kernel is used to produce all levels in the pyramid. Kernel should be small and separable
GL =Reduce(Gl-1 )
![Page 17: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/17.jpg)
17
The Laplacian Pyramid
series of band-pass imagesobtained by subtracting each Gaussian (low-pass) pyramid level from the next-lower level in the pyramid.
![Page 18: Segmentation. (template) matching](https://reader033.fdocuments.us/reader033/viewer/2022052821/628fdd61c6bfc35e9a532899/html5/thumbnails/18.jpg)
18
Flexible templatesTarget might not be exactly the same in every imageIdea: break the template into pieces and try to match each piecePosition the entire template over the neighborhood, then search around the position of each subtemplate for the best matchOverall match is best combined match for all subtemplates
From B. Morse, http://morse.cs.byu.edu/650/