segmentation. (template) matching

18
1 Segmentation. (template) matching

Upload: others

Post on 27-May-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Segmentation. (template) matching

1

Segmentation. (template) matching

Page 2: Segmentation. (template) matching

2

Reading

6.4Adelson and Bergen, Image Pyramids

Page 3: Segmentation. (template) matching

3

Template matching

Assumes you know what you are looking for (supervised process)

Page 4: Segmentation. (template) matching

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

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

6

Optimality matching criterion evaluation

Page 7: Segmentation. (template) matching

7

Challenge

We need scaled representations because the details of interest can occur at various scales

Page 8: Segmentation. (template) matching

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

9

AliasingCan’t shrink an image by taking every second pixelIf we do, characteristic errors appear

Page 10: Segmentation. (template) matching

10

Page 11: Segmentation. (template) matching

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

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

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

14

A Gaussian Pyramid

Page 15: Segmentation. (template) matching

15

Levels of the Gaussian pyramid expanded to the size of the original image

Page 16: Segmentation. (template) matching

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

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

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/