5.1 extracting edges

16
Extracting Lines 16-385 Computer Vision (Kris Kitani) Carnegie Mellon University

Upload: others

Post on 03-Jan-2022

17 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 5.1 Extracting Edges

Extracting Lines16-385 Computer Vision (Kris Kitani)

Carnegie Mellon University

Page 2: 5.1 Extracting Edges

Where is the boundary of the mountain top?

Page 3: 5.1 Extracting Edges

Lines are hard to find

Edge detection

Noisy edge image Incomplete boundaries

ThresholdingOriginal image

Page 4: 5.1 Extracting Edges

idea #1: morphology

Morphology (shrink, expand, shrink)

Sobel Threshold

What are some problems with the approach?

Page 5: 5.1 Extracting Edges

Dilation

If filter response > 0, set to 1

ErosionIf filter response is MAX, set

to 1

Page 6: 5.1 Extracting Edges

idea #2: breaking linesDivide and Conquer:

Connect A and B with Line

Find strongest edge along line bisector

Use edge point as break point

Repeat

Given: Boundary lies between points A and B Task: Find boundary

What are some problems with the approach?

Page 7: 5.1 Extracting Edges

idea #3: line fittingcmxy +=

cmxy ii −−

),( ii yxy

x

Given: Many pairs

Find: Parameters

Minimize: Average square distance:

Using:

Note:

),( ii yx

),( cm

∑−−

=i

ii

Ncmxy

E2)(

What are some problems with the approach?

Page 8: 5.1 Extracting Edges

idea #3: line fittingcmxy +=

cmxy ii −−

),( ii yxy

x

Given: Many pairs

Find: Parameters

Minimize: Average square distance:

Using:

Note:

),( ii yx

),( cm

∑−−

=i

ii

Ncmxy

E2)(

0&0 =∂

∂=

cE

mE xmyc −=

∑−

−−=

ii

iii

xx

yyxxm 2)(

))((

N

yy i

i∑=

N

xx i

i∑=

What are some problems with the approach?

Page 9: 5.1 Extracting Edges

Data: (x1, y1), …, (xn, yn) Line equation: yi = m xi + b

)()()(2)()(

1

1

2

11

XBXBYXBYYXBYXBYXBYE

bm

Bx

xX

y

yY

TTTT

nn

+−=−−=−=

"#

$%&

'=

"""

#

$

%%%

&

'

=

"""

#

$

%%%

&

'

= !!!

022 =−= YXXBXdBdE TT

Normal equations: least squares solution to XB=Y

∑ =−−=

n

i ii bxmyE1

2)(

(xi, yi)

YXXBX TT =

Find (m, b) to minimize

)()()(2)()(

1

1

2

11

XBXBYXBYYXBYXBYXBYE

bm

Bx

xX

y

yY

TTTT

nn

+−=−−=−=

"#

$%&

'=

"""

#

$

%%%

&

'

=

"""

#

$

%%%

&

'

= !!!

Page 10: 5.1 Extracting Edges

Problems with parameterizations

y

x

Where is the line that minimizes E? ∑ =−−=

n

i ii bxmyE1

2)(

Page 11: 5.1 Extracting Edges

Problems with parameterizations

y

x

Huge E!

Where is the line that minimizes E? ∑ =−−=

n

i ii bxmyE1

2)(

Page 12: 5.1 Extracting Edges

Problems with parameterizations

y

x

Line that minimizes E!!

Where is the line that minimizes E? ∑ =−−=

n

i ii bxmyE1

2)(

Page 13: 5.1 Extracting Edges

Problems with parameterizations

y

x

Line that minimizes E!!

Where is the line that minimizes E?

(Error E must be formulated carefully!)

∑ +−=i

ii yxN

E 2)sincos(1

θθρUse this instead: I’ll explain this later …

Page 14: 5.1 Extracting Edges

Line fitting is easily setup as a maximum likelihood problem … but choice of model is important

Page 15: 5.1 Extracting Edges

Problems with noise

Squared error heavily penalizes outliersLeast-squares error fit

Page 16: 5.1 Extracting Edges

Model fitting is difficult because…

• Extraneous data: clutter or multiple models – We do not know what is part of the model? – Can we pull out models with a few parts from much larger

amounts of background clutter? • Missing data: only some parts of model are present • Noise

• Cost: – It is not feasible to check all combinations of features by fitting

a model to each possible subset

So what can we do?