Segmentation. (template) matching

Post on 27-May-2022

8 views 0 download

Transcript of Segmentation. (template) matching

1

Segmentation. (template) matching

2

Reading

6.4Adelson and Bergen, Image Pyramids

3

Template matching

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

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.

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.

6

Optimality matching criterion evaluation

7

Challenge

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

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

9

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

10

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

12

Detecting a target pattern (cont’d)

Or maintain a fixed scale of the target and change the scale of the image

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.

14

A Gaussian Pyramid

15

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

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 )

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.

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/