pyramids - cs.cornell.edu

67
Pyramids

Upload: others

Post on 16-Apr-2022

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pyramids - cs.cornell.edu

Pyramids

Page 2: Pyramids - cs.cornell.edu

Gaussianpre-filtering• Solution:filter

theimage,thensubsample

blur

F0 H*

subsample blur subsample …F1

F1 H*

F2F0

Page 3: Pyramids - cs.cornell.edu

blur

F0 H*

subsample blur subsample …F1

F1 H*

F2F0

{Gaussianpyramid

Page 4: Pyramids - cs.cornell.edu

Gaussianpyramids[BurtandAdelson,1983]

• Incomputergraphics,amip map[Williams,1983]

GaussianPyramidshaveallsortsofapplicationsincomputervision

Source:S.Seitz

Page 5: Pyramids - cs.cornell.edu

Gaussianpyramids- Searchingoverscales

Page 6: Pyramids - cs.cornell.edu

Gaussianpyramids- Searchingoverscales

Page 7: Pyramids - cs.cornell.edu

2)*( 23 ¯= gaussianGG

1G

The Gaussian Pyramid

High resolution

Low resolution

Image=0G

2)*( 01 ¯= gaussianGG

2)*( 12 ¯= gaussianGG

2)*( 34 ¯= gaussianGG

blur

blur

blur

blur

Page 8: Pyramids - cs.cornell.edu

Gaussianpyramidandstack

Source: Forsyth

Page 9: Pyramids - cs.cornell.edu

MemoryUsage• Whatisthesizeofthepyramid?

9

Page 10: Pyramids - cs.cornell.edu

Laplacianpyramid

Re-duce

=--

-

=

=

=-

Page 11: Pyramids - cs.cornell.edu

Laplacianpyramid

L3 =G3 - expand(G4)=L2 =G2 - expand(G3)=

L1 =G1 - expand(G2)=

L0 =G0 - expand(G1)=

L4 =G4 =

Page 12: Pyramids - cs.cornell.edu

ReconstructingtheimagefromaLaplacianpyramid

=++

+

=

=

=+

Page 13: Pyramids - cs.cornell.edu

Laplacian pyramid

Source: Forsyth

Page 14: Pyramids - cs.cornell.edu

Edgedetection

Page 15: Pyramids - cs.cornell.edu

Whyedges?

• Resiliencetolightingandcolor• usefulforrecognition,matchingpatchesacrossimages

Page 16: Pyramids - cs.cornell.edu

Whyedges?

• Humansaresensitivetoedges• Converta2Dimageintoasetofcurves

– Extractssalientfeaturesofthescene, morecompact

Page 17: Pyramids - cs.cornell.edu

Whyedges?

• Cuetoshapeandgeometry• usefulforrecognition,understanding3Dstructure

Credit:Jitendra Malik

Credit:Attneave

Page 18: Pyramids - cs.cornell.edu

Whyedges?

• Groupingpixelsintoobjects(“perceptualorganization”)

Page 19: Pyramids - cs.cornell.edu

Thislecture

• Edgedetectioningeneral• Edgedetectionforgrouping

Page 20: Pyramids - cs.cornell.edu

Edges

• Edgesarecurvesintheimage,acrosswhichthebrightnesschanges“alot”

• Corners/Junctions

Page 21: Pyramids - cs.cornell.edu

Aside

Page 22: Pyramids - cs.cornell.edu

Closeupofedges

Source:D.Hoiem

Page 23: Pyramids - cs.cornell.edu

Closeup ofedges

Source:D.Hoiem

Page 24: Pyramids - cs.cornell.edu

Closeup ofedges

Source:D.Hoiem

Page 25: Pyramids - cs.cornell.edu

Closeup ofedges

Source:D.Hoiem

Page 26: Pyramids - cs.cornell.edu

Characterizingedges•Anedgeisaplaceofrapidchangeintheimageintensityfunction

imageintensityfunction

(alonghorizontalscanline) firstderivative

edgescorrespondtoextremaofderivativeSource:L.Lazebnik

Page 27: Pyramids - cs.cornell.edu

Intensityprofile

Source:D.Hoiem

Page 28: Pyramids - cs.cornell.edu

Derivativesandconvolution

• Differentiationislinear

• Differentiationisshift-invariant• Derivativeofshiftedsignalisshiftedderivative

• Hence,differentiationcanberepresentedasconvolution!

@(af(x) + bg(x))

@x

= a

@f(x)

@x

+ b

@g(x)

@x

Page 29: Pyramids - cs.cornell.edu

• Howcanwedifferentiateadigital imageF[x,y]?– Option1:reconstructacontinuousimage,f, thencomputethederivative

– Option2:takediscretederivative(finitedifference)

1 -1

Howwouldyouimplementthisasalinearfilter?

Imagederivatives

-1

1: :

Source:S.Seitz

Page 30: Pyramids - cs.cornell.edu

Thegradientpointsinthedirectionofmostrapidincreaseinintensity

Imagegradient• Thegradient ofanimage:

Theedgestrength isgivenbythegradientmagnitude:

Thegradientdirectionisgivenby:

• howdoesthisrelatetothedirectionoftheedge?Source:SteveSeitz

Page 31: Pyramids - cs.cornell.edu

Imagegradient

Source:L.Lazebnik

Page 32: Pyramids - cs.cornell.edu

WithalittleGaussiannoise

Gradient

Source:D.Hoiem

Page 33: Pyramids - cs.cornell.edu

Effectsofnoise

Whereistheedge?Source:S.Seitz

Noisyinputimage

Page 34: Pyramids - cs.cornell.edu

Effectsofnoise

• Noiseishighfrequency• Differentiationaccentuatesnoise

d sin!x

dx

= ! cos!x

Page 35: Pyramids - cs.cornell.edu

Solution:smoothfirst

f

h

f * h

Source:S.SeitzTofindedges,lookforpeaksin

Page 36: Pyramids - cs.cornell.edu

•Differentiationisaconvolution• Convolutionisassociative:• Thissavesusoneoperation:

Associativepropertyofconvolution

f

Source:S.Seitz

Page 37: Pyramids - cs.cornell.edu

2Dedgedetectionfilters

GaussianderivativeofGaussian(x)

Page 38: Pyramids - cs.cornell.edu

DerivativeofGaussianfilter

x-direction y-direction

Page 39: Pyramids - cs.cornell.edu
Page 40: Pyramids - cs.cornell.edu

TwoDimensionalGaussian

Page 41: Pyramids - cs.cornell.edu

OrientedGaussianFirstandSecondDerivatives

Page 42: Pyramids - cs.cornell.edu

Grouping

Page 43: Pyramids - cs.cornell.edu

Whatisgrouping?

Page 44: Pyramids - cs.cornell.edu

Whygrouping?

• Pixelspropertyofsensor,notworld• Reasoningatobjectlevel(might)makethingseasy:

• objectsatconsistentdepth• objectscanberecognized• objectsmoveasone

"I stand at the window and see a house, trees, sky. Theoretically I might say there were 327 brightnesses and nuances of colour. Do I have "327"? No. I have sky, house, and trees."Max Wertheimer

Page 45: Pyramids - cs.cornell.edu

RegionsBoundaries

Page 46: Pyramids - cs.cornell.edu

Isgroupingwell-defined?

• Dependsonpurpose• Objectparts• Backgroundsegmentation

A

B C

Page 47: Pyramids - cs.cornell.edu

Isgroupingwell-defined?

A

B C

Image

BG L-bird R-bird

grass bush

headeye

beakfar body

headeye

beak body

Perceptualorganizationformsatree:

BA

C

D.Martin,C.Fowlkes,D.Tal,J.Malik."ADatabaseofHumanSegmentedNaturalImagesanditsApplicationtoEvaluatingSegmentationAlgorithmsandMeasuringEcologicalStatistics",ICCV,2001

Page 48: Pyramids - cs.cornell.edu

Howdowegroupthings?

• Gestalt principles• Principleofproximity

https://courses.lumenlearning.com/wsu-sandbox/chapter/gestalt-principles-of-perception/

Page 49: Pyramids - cs.cornell.edu

Howdowegroupthings?

• Gestaltprinciples• Principleofsimilarity

https://courses.lumenlearning.com/wsu-sandbox/chapter/gestalt-principles-of-perception/

Page 50: Pyramids - cs.cornell.edu

Howdowegroupthings?

• Gestaltprinciples• Principleofcontinuityandclosure

https://courses.lumenlearning.com/wsu-sandbox/chapter/gestalt-principles-of-perception/

Page 51: Pyramids - cs.cornell.edu

Howdowegroupthings?

• Gestaltprinciples• Principleofcommonfate

Page 52: Pyramids - cs.cornell.edu

Gestaltprinciplesinthecontextofimages• Principleofproximity:nearbypixelsarepartofthesameobject

• Principleofsimilarity:similarpixelsarepartofthesameobject

• Lookfordifferencesincolor,intensity,ortextureacrosstheboundary

• Principleofclosureandcontinuity:contoursarelikelytocontinue

• High-levelknowledge?

Page 53: Pyramids - cs.cornell.edu

RegionsBoundaries

Page 54: Pyramids - cs.cornell.edu

Designingagoodboundarydetector• Differencesincolor,intensity,ortextureacrosstheboundary

• Continuityandclosure• High-levelknowledge

Page 55: Pyramids - cs.cornell.edu

Criteriaforagoodboundarydetector

•Criteriaforagoodboundarydetector:• Gooddetection: Fireonlyonrealedges,notanywhereelse• Goodlocalization

• theedgesdetectedmustbeascloseaspossibletothetrueedges

• thedetectormustreturnonepointonlyforeachtrueedgepoint

Source: L. Fei-Fei

Page 56: Pyramids - cs.cornell.edu

Cannyedgedetector•Theclassicedgedetector•Baselineforalllaterworkongrouping• Theoreticalmodel:step-edgescorruptedbyadditiveGaussiannoise

J.Canny,AComputationalApproachToEdgeDetection,IEEETrans.PatternAnalysisandMachineIntelligence,8:679-714,1986.

Source: L. Fei-Fei22,000 citations!

Page 57: Pyramids - cs.cornell.edu

Example

originalimage

Page 58: Pyramids - cs.cornell.edu

ComputeGradients(DoG)

X-Derivative of Gaussian Y-Derivative of Gaussian

Page 59: Pyramids - cs.cornell.edu

Gradientmagnitudeandorientation• Orientationisundefinedatpixelswith0gradient

Orientationtheta = numpy.arctan2(gy, gx)

Magnitude

Page 60: Pyramids - cs.cornell.edu

Non-maximumsuppressionforeachorientation

Atq,wehaveamaximumifthevalueislargerthanthoseatbothpandatr.Interpolatetogetthesevalues.

Source: D. Forsyth

Page 61: Pyramids - cs.cornell.edu

BeforeNon-maxSuppression

Page 62: Pyramids - cs.cornell.edu

AfterNon-maxSuppression

Page 63: Pyramids - cs.cornell.edu

Hysteresisthresholding• Thresholdatlow/highlevelstogetweak/strongedgepixels• Doconnectedcomponents,startingfromstrongedgepixels

Page 64: Pyramids - cs.cornell.edu

FinalCannyEdges

Page 65: Pyramids - cs.cornell.edu

Cannyedgedetector

1. Filterimagewithx,yderivativesofGaussian2. Findmagnitudeandorientationofgradient3. Non-maximumsuppression:

• Thinmulti-pixelwide“ridges”downtosinglepixelwidth

4. Thresholding andlinking(hysteresis):• Definetwothresholds:lowandhigh• Usethehighthresholdtostartedgecurvesandthelow

thresholdtocontinuethem

Source: D. Lowe, L. Fei-Fei

Page 66: Pyramids - cs.cornell.edu

DoesCannyalwayswork?

Page 67: Pyramids - cs.cornell.edu

Thechallengesofedgedetection

• Texture• Low-contrastboundaries