matching image patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · rené magritte,...

12
CSC320 Michael Guerzhoy Many slides from Steve Marschner, Alexei Efros Matching Image Patches René Magritte, “Golconda”

Upload: others

Post on 22-Sep-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

CSC320Michael GuerzhoyMany slides from

Steve Marschner, Alexei Efros

Matching Image Patches

René Magritte, “Golconda”

Page 2: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Template matching

Goal: find in image

Main challenge: What is a good similarity or distance measure between two patches?• Dot product• (Zero-mean) correlation• Sum Square Difference• Normalized Cross Correlation

Slide contents from Derek Hoiem and Alexei Efros

Page 3: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Images as vectors

Page 4: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 0: filter the image with eye patch

Input Filtered Image

],[],[],[,

lnkmflkgnmhlk

What went wrong?

f = imageg = filter

Slide by Derek Hoiem

Page 5: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 1: filter the image with zero-mean eye

Input Filtered Image (scaled) Thresholded Image

)],[()],[(],[,

lnkmgflkfnmhlk

True detections

False detections

mean of f (here, f is the filter)

Page 6: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 2: SSD

Input 1- sqrt(SSD) Thresholded Image

2

,

)],[],[(],[ lnkmflkgnmhlk

True detections

Page 7: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 2: SSD

Input 1- sqrt(SSD)

2

,

)],[],[(],[ lnkmflkgnmhlk

What’s the potential downside of SSD?

Slide by Derek Hoiem

Page 8: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 3: Normalized cross-correlation

5.0

,

2,

,

2

,,

)],[()],[(

)],[)(],[(

],[

lknm

lk

nmlk

flnkmfglkg

flnkmfglkg

nmh

mean image patchmean template

Slide by Derek Hoiem

Page 9: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 3: Normalized cross-correlation

Input Normalized X-Correlation Thresholded Image

True detections

Page 10: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Matching with filters

Goal: find in image

Method 3: Normalized cross-correlation

Input Normalized X-Correlation Thresholded Image

True detections

Page 11: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Q: What is the best method to use?

A: Depends

Zero-mean filter: fastest but not a great matcher

SSD: next fastest, sensitive to overall intensity

Normalized cross-correlation: slowest, invariant to local average intensity and contrast

Slide by Derek Hoiem

Page 12: Matching Image Patches - cs.toronto.eduguerzhoy/320/lec/patches_filters.pdf · René Magritte, “Golconda” Template matching Goal: find in image Main challenge: What is a good

Image half-sizing

This image is too big tofit on the screen. Howcan we reduce it?

How to generate a half-sized version?