computer and robot vision i

156
Computer and Robot Vision I Chapter 7 Conditioning and Labeling Presented by: 傅傅傅 & 傅傅傅 [email protected] 傅傅傅傅 : 傅傅傅 傅傅

Upload: kimn

Post on 23-Feb-2016

44 views

Category:

Documents


0 download

DESCRIPTION

Computer and Robot Vision I. Chapter 7 Conditioning and Labeling. Presented by: 傅楸善 & 江祖榮 [email protected] 指導教授 : 傅楸善 博士. Recognition Methodology. Conditioning Labeling Grouping Extracting Matching. 7-1 Introduction. Conditioning: noise removal, background normalization,… - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computer and Robot Vision I

Computer and Robot Vision I

Chapter 7Conditioning and Labeling

Presented by: 傅楸善 & 江祖榮 [email protected]指導教授 : 傅楸善 博士

Page 2: Computer and Robot Vision I

Recognition Methodology

Conditioning Labeling Grouping Extracting Matching

2/118

Page 3: Computer and Robot Vision I

dDC & CV Lab.CSIE NTU

3/118

7-1 Introduction

Conditioning: noise removal, background normalization,…

Labeling: thresholding, edge detection, corner finding,…

Page 4: Computer and Robot Vision I

4/118

7-2 Noise Cleaning

noise cleaning: • uses neighborhood spatial coherence• uses neighborhood pixel value homogeneity

Page 5: Computer and Robot Vision I

7-2 Filter

5/118

f(x-1,y-1) f(x,y-1) f(x+1,y-1)f(x-1,y) f(x,y) f(x+1,y)

f(x-1,y+1) f(x,y+1) f(x+1,y+1)

W(-1,-1) W(0,-1) W(1,-1)W(-1,0) W(0,0) W(1,0)W(-1,1) W(0,1) W(1,1)

Y axis

X axis

image Filter

Page 6: Computer and Robot Vision I

6/118

box filter: computes equally weighted averagebox filter: separablebox filter: recursive implementation with “two+”, “two-”, “one/” per pixel

7.2 Noise Cleaning

Page 7: Computer and Robot Vision I

filter: separable

7/118

9 multiplications 3 multiplications

* = *

3 multiplications

* = *

9 multiplications 3 multiplications 3 multiplications

Page 8: Computer and Robot Vision I

8/118

filter: separable

Page 9: Computer and Robot Vision I

box filter: recursive implementation

9/118

Page 10: Computer and Robot Vision I

10/118

7.2 Noise Cleaning

Page 11: Computer and Robot Vision I

11/118

=* = *

7.2 Noise Cleaning

Page 12: Computer and Robot Vision I

12/118

=* = *

7.2 Noise Cleaning

Page 13: Computer and Robot Vision I

13/118

7.2 Noise Cleaning

Gaussian filter: linear smoother)(

21

2

22

),( cr

kecrw

for all where,),( Wcr

Wcr

cr

e

k

),(

)(21

2

22

1

linear noise-cleaning filters: defocusing images, edges blurred

size of W: two or three from center

weight matrix:

Page 14: Computer and Robot Vision I

Take a Break 0

14/118

Page 15: Computer and Robot Vision I

15/118

A Statistical Framework for Noise Removal

Idealization assumption: if there were no noise, the pixel values in each image neighborhood would be the same constant

Page 16: Computer and Robot Vision I

16/118

Outlier or Peak Noise

outlier: peak noise: pixel value replaced by random noise value

neighborhood size: larger than noise, smaller than preserved detail

center-deleted: neighborhood pixel values in neighborhood except center

Page 17: Computer and Robot Vision I

Outlier or Peak Noise

X1 X2 X3

X4 y X5

X6 X7 X8

17/118

Decide whether y is an outlier or not

:y center pixel value

N

nnx

N 1

1

:,...,1 Nxx center-deleted neighborhood

Page 18: Computer and Robot Vision I

18/118

Outlier or Peak Noise

:,...,1 Nxx

:y

:

N

nnx

N 1

1

center-deleted neighborhood

center pixel value

mean of center-deleted neighborhood

2

1

)ˆ-(

N

nnxminimizes

Page 19: Computer and Robot Vision I

19/118

Outlier or Peak Noise

:_ removaloutlierzˆif | |

_ ˆ otherwise{y y

outlier removalz

output value of neighborhood outlier removal

:y

::

not an outlier value if reasonably close toy use mean value when outlierthreshold for outlier valuetoo small: edges blurredtoo large: noise cleaning will not be good

Page 20: Computer and Robot Vision I

20/118

Outlier or Peak Noise

:ˆ 2

N

nnx

N 1

22 )ˆ(1

ˆif | |

ˆˆ otherwise

{yy

contrast dependent outlier removalz

center-deleted neighborhood variance

: use neighborhood mean if pixel value significantly far from mean

Page 21: Computer and Robot Vision I

7-2-3 Outlier or Peak Noise

21/118

Page 22: Computer and Robot Vision I

22/118

7-2-3 Outlier or Peak Noise

smooth replacement: instead of complete replacement or not at all

:treplacemensmoothz convex combination of input and mean

:K weighting parameter

yKy

K

Ky

y

z treplacemensmooth

|

ˆˆ

ˆ|

ˆ|

use neighborhood mean

use input pixel value

:0K

:K y

Page 23: Computer and Robot Vision I

23/118

7-2-4 K-Nearest Neighbor

K-nearest neighbor: average equally weighted average of k-nearest neighbors

Page 24: Computer and Robot Vision I

24/118

7-2-5 Gradient Inverse weighted

gradient inverse weighted: reduces sum-of-squares error within regions

' '

' '

1 ( , ) ( , )' ' 2otherwise

1max{ , | ( , ) ( , )|}2

( , , , ) { r c r c

k

f r c f r c

w r c r c

Page 25: Computer and Robot Vision I

25/118

Take a Break 1

Page 26: Computer and Robot Vision I

26/118

7-2-6 Order Statistic Neighborhood Operators

order statistic: linear combination of neighborhood sorted values

neighborhood pixel values

sorted neighborhood values from smallest to largest

:,,1 Nxx

:,..., )()1( Nxx

Page 27: Computer and Robot Vision I

7-2-6 Order Statistic Neighborhood Operators

27/118

:,, 91 xx

:,..., )9()1( xx

x1 x2 x3 x4 x5 x6 x7 x8 x916 128 109 66 4 6 96 84 53

x(1) x(2) x(3) x(4) x(5) x(6) x(7) x(8) x(9)4 6 16 53 66 84 96 109 128

Page 28: Computer and Robot Vision I

28/118

7-2-6 Order Statistic Neighborhood Operators

Median Operator

median: most common order statistic operator

median root: fixed-point result of a median filter

median roots: comprise only constant-valued neighborhoods, sloped edges

Page 29: Computer and Robot Vision I

29/118

Original Image

Median Root Image

Page 30: Computer and Robot Vision I

30/118

7-2-6 Order Statistic Neighborhood Operators

median: effective for impulsive noise (salt and pepper)

median: distorts or loses fine detail such as thin lines

)2

1( Nmedian xz

Page 31: Computer and Robot Vision I

31/118

7-2-6 Order Statistic Neighborhood Operators

inter-quartile distance:Q

)4

2()4

23( NN xxQ

otherwise

||if zy

zy

z Qmedian

mediandianrunning me

Running-median Operator

Page 32: Computer and Robot Vision I

32/118

7-2-6 Order Statistic Neighborhood Operators

Trimmed-Mean Operator

trimmed-mean: first k and last k order statistics not used

trimmed-mean: equal weighted average of central N-2k order statistics

kN

knnmeantrimmed x

kNz

1)(2

1

Page 33: Computer and Robot Vision I

33/118

7-2-6 Order Statistic Neighborhood Operators

Midrange operator

midrange: noise distribution with light and smooth tails

][21

)()1( Nmidrange xxz

Page 34: Computer and Robot Vision I

34/118

7-2-7 Hysteresis Smoothing

hysteresis smoothing: removes minor fluctuations, preserves major transients

hysteresis smoothing: finite state machine with two states: UP, DOWNapplied row-by-row and then column-by-column

Page 35: Computer and Robot Vision I

35/118

7-2-7 Hysteresis Smoothing

if state DOWN and next one larger, if next local maximum does not exceed threshold then stays current value i.e. small peak cuts flat

otherwise state changes from DOWN to UP and preserves major transients

Page 36: Computer and Robot Vision I

36/118

7-2-7 Hysteresis Smoothing

if state UP and next one smaller, if next local minimum does not exceed threshold then stays current value i.e. small valley filled flat

otherwise state changes from UP to DOWN and preserves major transients

Page 37: Computer and Robot Vision I

37/118

7-2-7 Hysteresis Smoothing

Page 38: Computer and Robot Vision I

Take a Break 2

38/118

Page 39: Computer and Robot Vision I

39/118

Sigma Filter

sigma filter: average only with values within two-sigma interval

Mn

nxM

y#

}22|{ yxynMwhere n

Page 40: Computer and Robot Vision I

40/118

Selected-Neighborhood Averaging

selected-neighborhood averaging: assumes pixel a part of homogeneous region (not required to be squared, others can be diagonal, rectangle, three

pixels vertical and horizontal neighborhood)

noise-filtered value: mean value from lowest variance neighborhood

Page 41: Computer and Robot Vision I

41/118

Minimum Mean Square Noise Smoothing

minimum mean square noise smoothing: additive or multiplicative noise

each pixel in true image: regarded as a random variable

Page 42: Computer and Robot Vision I

42/118

Minimum Mean Square Noise Smoothing

YZ

ZY

])[(

error squaremean minimize to and choose :Goal

22 YYE

variables:,valuepixelestimated:

noise:valuepixel:

valuepixelobserved:

Y

YZ

Page 43: Computer and Robot Vision I

43/118

Noise-Removal Techniques-Experiments

Page 44: Computer and Robot Vision I

44/118

Noise-Removal Techniques-Experiments

uniform Gaussian salt and pepper varying noise (the noise energy varies across the image)

types of noise

Page 45: Computer and Robot Vision I

45/118

Noise-Removal Techniques-Experiments

salt and pepper

:maxmini

gray value at given pixel in output image

:p:u:),( crI:),( crO

),( cr

{ if),(

otherwise)( minmaxmin

),(pucrI

uiiicrO

minimum/ maximum gray value for noise pixels

fraction of image to be corrupted with noise

uniform random variable in [0,1]

gray value at given pixel in input image

),( cr

Page 46: Computer and Robot Vision I

46/118

Generate salt-and-pepper noise

Noise-Removal Techniques-Experiments

I(nim, i , j) = 0 if uniform(0,1) < 0.05I(nim, i , j) = 255 if uniform(0,1) > 1- 0.05I(nim, i , j) = I(im, i ,j) otherwiseuniform(0,1) : random variable uniformly distributed over [0,1]

Page 47: Computer and Robot Vision I

47/118

Noise-Removal Techniques-Experiments

S/N ratio (signal to noise ratio):

VS: image gray level variance VN: noise variance

𝑆𝑁𝑅=20∗ log10√𝑉𝑆√𝑉𝑁

Page 48: Computer and Robot Vision I

Noise-Removal Techniques-Experiments

48/118

𝑆𝑁𝑅=20∗ log10√𝑉𝑆√𝑉𝑁

𝑉𝑆=∑∀ 𝑛

( (𝐼 (𝑖 , 𝑗 )−𝜇𝑠 ))2

‖𝑛‖

𝜇𝑠=∑∀𝑛

𝐼 (𝑖 , 𝑗 )

‖𝑛‖

𝜇𝑁𝑜𝑖𝑠𝑒=∑∀𝑛

𝐼𝑁𝑜𝑖𝑠𝑒 (𝑖 , 𝑗 )− 𝐼 (𝑖 , 𝑗)

‖𝑛‖

𝑉𝑁=∑∀𝑛

( ( 𝐼𝑁𝑜𝑖𝑠𝑒 (𝑖 , 𝑗 )− 𝐼 (𝑖 , 𝑗)−𝜇𝑁𝑜𝑖𝑠𝑒 ) )2

‖𝑛‖

Page 49: Computer and Robot Vision I

49/118

Take a Break 3

Page 50: Computer and Robot Vision I

50/118

Noise-Removal Techniques-Experiments

uniform noise

variessalt and pepper noise

Gaussian noise

Page 51: Computer and Robot Vision I

Uniform

S & P Gaussiannoise

Original

Page 52: Computer and Robot Vision I

default peak noise removal

2.0,99;{ |ˆ|

ˆ_

yify

otherwiseremovaloutlierz

Page 53: Computer and Robot Vision I

Uniform

S & P Gaussian

outlier removal

Uniform

S & P Gaussian

Page 54: Computer and Robot Vision I

contrast-dependent noise removal

1.0,99;{ |ˆ

ˆ|

ˆ

yify

otherwiseremovaloutlierdependentcontrastz

Page 55: Computer and Robot Vision I

Uniform

S & P Gaussian

contrast-dependent outlier removal

Uniform

S & P Gaussian

Page 56: Computer and Robot Vision I

2.0,4.0,99;ˆ|

ˆˆ

|

ˆ|

ˆ|

KKy

y

yKy

Kz treplacemensmooth

smooth replacement

Page 57: Computer and Robot Vision I

Uniform

S & P Gaussian

contrast-dependent outlier removal with smooth

replacement

Uniform

S & P Gaussian

Page 58: Computer and Robot Vision I

hysteresis smoothing

Page 59: Computer and Robot Vision I

Uniform

S & P Gaussian

hysteresis smoothing

Uniform

S & P Gaussian

Page 60: Computer and Robot Vision I

inter-quartile mean filter

5.0,77;{ ||

Qzy

ify

otherwisez

median

median

z

)4

2()4

23( NN xxQ

Page 61: Computer and Robot Vision I

Uniform

S & P Gaussian

inter-quartile mean filter

Uniform

S & P Gaussian

Page 62: Computer and Robot Vision I

neighborhood midrange filter

77;][21

)()1( Nmidrange xxz

Page 63: Computer and Robot Vision I

Uniform

S & P Gaussian

neighborhood midrange filter

Uniform

S & P Gaussian

Page 64: Computer and Robot Vision I

neighborhood running-mean filter

)77,( filterbox

Page 65: Computer and Robot Vision I

Uniform

S & P Gaussian

neighborhood running-mean filter

Uniform

S & P Gaussian

Page 66: Computer and Robot Vision I

sigma filter

Mn

nxM

y#

2.0,99;}22|{ yxynMwhere n

Page 67: Computer and Robot Vision I

Uniform

S & P Gaussian

sigma filter

Uniform

S & P Gaussian

Page 68: Computer and Robot Vision I

neighborhood weighted median filter

(7X7)

)77(

1111111122222112333211234321123332112222211111111

Page 69: Computer and Robot Vision I

Uniform

S & P Gaussian

neighborhood weighted median filter

Uniform

S & P Gaussian

Page 70: Computer and Robot Vision I

70/118

Uniform Gaussian_30 S & P 0.1Contrast-dependent outlier removal 26.408 25.758 20.477Smooth replacement 29.344 26.821 26.792Outlier removal 26.407 25.768 20.406Hysteresis 18.278 13.804 1.9040Interquartile mean filter 29.193 24.517 35.720Midrange filter 22.171 19.629 -0.1658Running-mean filter 29.522 28.278 21.194Sigma filter 34.717 18.831 -2.9151Weighted-median filter 33.964 30.720 36.033

Noise-Removal Techniques-Experiments with Lena

Page 71: Computer and Robot Vision I

71/118

7.3 Sharpening

unsharp masking: subtract fraction of neighborhood mean and scale result

N

nn meanodneighborhoisx

Nwhere

1

1

32,

51,:

::

betweenreasonablefractionk

ntconstascalingsvaluepixelcentery

possible to replace neighborhood mean with neighborhood median

]ˆ[ kyszsharpened

Page 72: Computer and Robot Vision I

72/118

Extremum Sharpening

extremum-sharpening: output closer of neighborhood maximum or minimum

{ ),(),(

max

min

maxminmin

max

}),(|),(max{}),(|),(min{

crfzzcrfifz

otherwisezsharpenedextremumz

WcrccrrfzWcrccrrfz

Page 73: Computer and Robot Vision I

73/118

Take a Break

Page 74: Computer and Robot Vision I

74/118

7.4 Edge Detection

digital edge: boundary where brightness values are significantly different

edge: brightness value appears to jump

Page 75: Computer and Robot Vision I

75/118

Page 76: Computer and Robot Vision I

76/118

Page 77: Computer and Robot Vision I

77/118

Page 78: Computer and Robot Vision I

78/118

Gradient Edge Detectors

gradient magnitude: where are values from first, second masks

respectively

22

21 rr

Roberts operators: two 2X2 masks to calculate gradient

21, rr

Page 79: Computer and Robot Vision I

79/118

Roberts operators with threshold = 30

Page 80: Computer and Robot Vision I

80/118

Gradient Edge Detectors

22

21 ppg

21, pp)arctan( 21 pp

Prewitt edge detector: two 3X3 masks in row column direction

gradient magnitude: gradient direction: clockwise w.r.t. column axis where are values from first, second masks respectively

P1

P2

)arctan( 21 pp

Page 81: Computer and Robot Vision I

81/118

Gradient Edge Detectors

)()1()(' xfxfxf

)1()()1(' xfxfxf

)1()1()1()()()1()1()( ''

xfxfxfxfxfxfxfxf

Page 82: Computer and Robot Vision I

82/118

Prewitt edge detector with threshold = 30

Page 83: Computer and Robot Vision I

83/118

Gradient Edge Detectors Sobel edge detector: two 3X3 masks in row column direction

gradient magnitude: gradient direction: clockwise w.r.t. column axis where are values from first, second masks respectively

22

21 ssg

)arctan( 21 ss21, ss

Page 84: Computer and Robot Vision I

84/118

Gradient Edge Detectors Sobel edge detector: 2X2 smoothing followed by 2X2 gradient

1111

1111

121000121

1111

1111

101202101

Page 85: Computer and Robot Vision I

85/118

Gradient Edge Detectors

1111

1111

101202101

000011011

1111

1111

000101101

00011111111

1111

1111

011112101

0101011011101

1111

1111

101202101

1011111112

101

1111

1111

Page 86: Computer and Robot Vision I

86/118

Sobel edge detector with threshold = 30

Page 87: Computer and Robot Vision I

87/118

Gradient Edge Detectors Frei and Chen edge detector: two in a set of nine orthogonal masks (3X3)

gradient magnitude: gradient direction: clockwise w.r.t. column axis where are values from first, second masks respectively

22

21 ffg

)arctan( 21 ff21, ff

Page 88: Computer and Robot Vision I

Gradient Edge Detectors orthogonal

88/118

101-2

02-

101-

1 2 1 0 0 0 1- 2- 1-

0 1 1- 1 - 1 1 1 (-1) 1 1(-1) (-1) (-1)

Page 89: Computer and Robot Vision I

89/118

Gradient Edge Detectors Frei and Chen edge detector: nine orthogonal masks (3X3)

Page 90: Computer and Robot Vision I

90/118

Frei and Chen edge detector with threshold = 30

Page 91: Computer and Robot Vision I

91/118

Gradient Edge Detectors

nnnkg

7,...,0,max

Kirsch: set of eight compass template edge masks

gradient magnitude:

gradient direction: nkmaxarg45

Page 92: Computer and Robot Vision I

92/118

Kirsch edge detector with threshold = 30

Page 93: Computer and Robot Vision I

93/118

Gradient Edge Detectors Robinson: compass template mask set with

only2,1,0

done by only four masks since negation of each mask is also a mask gradient magnitude and direction same as Kirsch operator

nnnrg

7,...,0,max

nrmaxarg45

Page 94: Computer and Robot Vision I

94/118

Robinson edge detector with threshold = 30

Page 95: Computer and Robot Vision I

95/118

Gradient Edge Detectors Nevatia and Babu: set of six 5X5 compass template masks

參考軸: y 軸

Page 96: Computer and Robot Vision I

96/118

Nevatia and Babu with threshold = 30

Page 97: Computer and Robot Vision I

97/118

Gradient Edge Detectors

edge contour direction: along edge, right side bright, left side dark

edge contour direction: more than gradient direction90

90

contour direction

gradient direction

Page 98: Computer and Robot Vision I

Robinson and Kirsch compass operator: detect lineal edges

Page 99: Computer and Robot Vision I

90

90 90 90

90

9090 90

Page 100: Computer and Robot Vision I

100/118

Gradient Edge Detectors

four important properties an edge operator might have

accuracy in estimating gradient magnitude accuracy in estimating gradient direction accuracy in estimating step edge contrast accuracy in estimating step edge direction

gradient direction: used for edge organization, selection, linking

Page 101: Computer and Robot Vision I

101/118

7.4.1 Gradient Edge Detectors

參考軸: X 軸 , 順時針方向

contour

Page 102: Computer and Robot Vision I

102/118

Take a Break

Page 103: Computer and Robot Vision I

103/118

Zero-Crossing Edge Detectors

first derivative maximum: exactly where second derivative zero crossing

first derivative maximum: exactly where second derivative zero crossing

Page 104: Computer and Robot Vision I

104/118

Zero-Crossing Edge Detectors

2

2

2

2

2

2

2

22 )(

cI

rII

crI

),( crILaplacian of a function

Page 105: Computer and Robot Vision I

105/118

Zero-Crossing Edge Detectors

two common 3X3 masks to calculate digital Laplacian

First type Second type

Page 106: Computer and Robot Vision I

106/118

Zero-Crossing Edge Detectors the 3X3 neighborhood values of an image function

Page 107: Computer and Robot Vision I

107/118

Zero-Crossing Edge Detectors

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321),( ckrckrkckrkkcrI

( r, c)

654

321

kkkkkk

631 kkk

654

321

kkkkkk

1k

421 kkk

421 kkk

654

321

kkkkkk

631 kkk

654

321

kkkkkk

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )1()1)(1()1()1()1()1,1( kkkkkkI

654

321

kkkkkk

631 kkk

654

321

kkkkkk

1k

421 kkk

421 kkk

654

321

kkkkkk

631 kkk

654

321

kkkkkk

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )0()0)(1()1()0()1()0,1( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )1()1)(1()1()1()1()1,1( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )1()1)(0()0()1()0()1,0( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )0()0)(0()0()0()0()0,0( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )1()1)(0()0()1()0()1,0( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )1()1)(1()1()1()1()1,1( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )0()0)(1()1()0()1()0,1( kkkkkkI

(-1,-1) (-1, 0) (-1, 1)

( 0,-1) ( 0, 0) ( 0, 1)

( 1,-1) ( 1, 0) ( 1, 1)2

652

4321 )1()1)(1()1()1()1()1,1( kkkkkkI

I(r,c) = k1+k2r+k3c+k4r2+k5rc+k6c2

Page 108: Computer and Robot Vision I

108/118

Zero-Crossing Edge Detectors

2

2

2

2

2

2

2

22 )(

cI

rII

crI

265

24321),( ckrckrkckrkkcrI

542 2 ckrkkrI

42

2

2krI

653 2ckrkkcI

62

2

2kcI

642

2

2

2

2

2

2

22 22)( kk

cI

rII

crI

Page 109: Computer and Robot Vision I

109/118

Zero-Crossing Edge Detectors

)(k)-kk(k)k-k(k)kk(k)k-k(k 1421421631631 41111

64 22 kk

] 111181

111 [31

654321654321421

6311631

654321421654321

)kkkkk(k)k-kk-kk(k)kk(k)kk(k)(k)-k-k(k

)k-kkk-k(k)k-k(k)kkk-k-k(k

6464 22 66 31 kkkk

Page 110: Computer and Robot Vision I

110/118

Zero-Crossing Edge Detectors 3X3 mask computing a digital Laplacian 12),44( babae

Page 111: Computer and Robot Vision I

111/118

Zero-Crossing Edge Detectors

)24()0(

)24()0()0(

)44(

6

5

4

3

2

1

bakk

bakkk

ebak

64 22 kk { )44(

12

ba-e

ba

Page 112: Computer and Robot Vision I

112/118

Zero-Crossing Edge Detectors

3X3 mask for computing minimum-variance digital Laplacian

First type

Page 113: Computer and Robot Vision I

)(21

22

22

21:

cr

eGaussian

2

2

2

2

:cI

rILaplacian

2

2

2

2

),(cG

rGcrLOG

)1(2

1

)(2

1

)(2

1

))2

1(()(

2

2)(21

4

)(21

2

2)(21

4

)(21

22

)(21

22

2

2

22

2

22

2

22

2

22

2

22

re

ere

err

errr

Grr

G

cr

crcr

cr

cr

)1(2

12

2)(21

42

22

22

ce

cG cr

)1(2

12

2)(21

42

22

22

re

rG cr

)(21

2

22

4

2

2)(21

42

2)(21

4

2

22

2

22

2

22

)2(2

1

)1(2

1)1(2

1),(

cr

crcr

ecr

cerecrLOG

Page 114: Computer and Robot Vision I

Laplacian of the Gaussian kernel

-2 -9 -23 -1 103 178 103 -1 -23 -9 -2

Page 115: Computer and Robot Vision I

115/118

Zero-Crossing Edge Detectors

Page 116: Computer and Robot Vision I

116/118

Page 117: Computer and Robot Vision I

117/118

Page 118: Computer and Robot Vision I
Page 119: Computer and Robot Vision I

119/118

Zero-Crossing Edge Detectors

Page 120: Computer and Robot Vision I

120/118

Zero-Crossing Edge Detectors

A pixel is declared to have a zero crossing if it is less than –t and one of its eight neighbors is greater than t or if it is greater than t and one of its eight neighbors is less than –t for some fixed threshold t

Page 121: Computer and Robot Vision I

121/118

Zero-Crossing Edge Detectors

t

-t

Page 122: Computer and Robot Vision I

122/118

Take a Break

Page 123: Computer and Robot Vision I

123/118

Edge Operator Performance

edge detector performance characteristics: misdetection/false-alarm rate

Page 124: Computer and Robot Vision I

124/118

Page 125: Computer and Robot Vision I

125/118

Page 126: Computer and Robot Vision I

126/118

7.5 Line Detection

A line segment on an image can be characterized as an elongated rectangular region having a homogeneous gray level bounded on both its longer sides by homogeneous regions of a different gray level

Page 127: Computer and Robot Vision I

127/118

7.5 Line Detection

one-pixel-wide lines can be detected by compass line detectors

Page 128: Computer and Robot Vision I

detecting lines of one to three pixels in width

Page 129: Computer and Robot Vision I

129/118

semilinear line detector by step edge on either side of the line

𝑠=max {𝑎𝑖+𝑏𝑖|𝑎𝑖>𝑡∧𝑏𝑖>𝑡 }

Page 130: Computer and Robot Vision I

130/118

Project due Nov. 26

Write the following programs

1. Generate additive white Gaussian noise

2. Generate salt-and-pepper noise

3. Run box filter (3X3, 5X5) on all noisy images

4. Run median filter (3X3, 5X5) on all noisy images

5. Run opening followed by closing or closing followed by opening

Page 131: Computer and Robot Vision I

131/118

Project due Nov. 26

box filter on white Gaussian noise with amplitude = 10Gaussian noise After 5x5 box filterAfter 3x3 box filter

Page 132: Computer and Robot Vision I

132/118

Project due Nov. 26

box filter on salt-and-pepper noise with threshold = 0.05salt-and-pepper noise After 5x5 box filterAfter 3x3 box filter

Page 133: Computer and Robot Vision I

133/118

Project due Nov. 26

median filter on white Gaussian noise with amplitude = 10Gaussian noise After 5x5 median filterAfter 3x3 median filter

Page 134: Computer and Robot Vision I

134/118

Project due Nov. 26

median filter on salt-and-pepper noise with threshold = 0.05salt-and-pepper noise After 5x5 median filterAfter 3x3 median filter

Page 135: Computer and Robot Vision I

135/118

Project due Nov. 26

Generate additive white Gaussian noise

:)1,0()1,0(),,(),,(

NNamplitudejiimIjinimI

Gaussian random variable with zero mean and st. dev. 1

amplitude determines signal-to-noise ratio, try 10, 30

Page 136: Computer and Robot Vision I

136/118

Project due Nov. 26 Generate additive white Gaussian noise with amplitude = 10

Page 137: Computer and Robot Vision I

137/118

Project due Nov. 26 Generate additive white Gaussian noise with amplitude = 30

Page 138: Computer and Robot Vision I

138/118

Project due Nov. 26

Generate salt-and-pepper noise

I( noiseImage,i ,j) = , if 𝑢𝑛𝑖𝑓𝑜𝑟𝑚 (0,1 )<0.05, if 𝑢𝑛𝑖𝑓𝑜𝑟𝑚 (0,1 )>1 −0.05, otherwise

1.0and05.0bothtry]1,0[overddistributeuniformlyriablevarandom:)1,0(uniform

Page 139: Computer and Robot Vision I

139/118

Project due Nov. 26 Generate salt-and-pepper noise with threshold = 0.05

Page 140: Computer and Robot Vision I

140/118

Project due Nov. 26 Generate salt-and-pepper noise with threshold = 0.1

Page 141: Computer and Robot Vision I

141/118

Project due Dec. 3

Roberts operator Prewitt edge detector Sobel edge detector Frei and Chen gradient operator Kirsch compass operator Robinson compass operator Nevatia-Babu 5X5 operator

Write programs to generate the following gradient magnitude images and choose proper thresholds to get the binary edge images:

Page 142: Computer and Robot Vision I

142/118

Project due Dec. 3

Roberts operator with threshold = 30

Page 143: Computer and Robot Vision I

143/118

Project due Dec. 3

Prewitt edge detector with threshold = 30

Page 144: Computer and Robot Vision I

144/118

Project due Dec. 3

Sobel edge detector with threshold = 30

Page 145: Computer and Robot Vision I

145/118

Project due Dec. 3

Frei and Chen gradient operator with threshold = 30

Page 146: Computer and Robot Vision I

146/118

Project due Dec. 3

Kirsch compass operator with threshold = 30

Page 147: Computer and Robot Vision I

147/118

Project due Dec. 3

Robinson compass operator with threshold = 30

Page 148: Computer and Robot Vision I

148/118

Project due Dec. 3

Nevatia-Babu 5X5 operator threshold = 30

Page 149: Computer and Robot Vision I

149/118

Project due Dec. 10

Write the following programs to detect edge:

Zero-crossing on the following four types of images to get edge images (choose proper thresholds), p. 349 Laplacian minimum-variance Laplacian Laplacian of Gaussian Difference of Gaussian, (use tk to generate D.O.G.) dog (inhibitory , excitatory , kernel size=11)

Page 150: Computer and Robot Vision I

150/118

Difference of Gaussian

Page 151: Computer and Robot Vision I

151/118

Difference of Gaussian

Page 152: Computer and Robot Vision I

152/118

Project due Dec. 10

Zero-crossing on the following four types of images to get edge images (choose proper thresholds t=1)

Page 153: Computer and Robot Vision I

153/118

Laplacian

Page 154: Computer and Robot Vision I

154/118

minimum-variance Laplacian

Page 155: Computer and Robot Vision I

155/118

Laplacian of Gaussian

Page 156: Computer and Robot Vision I

156/118

Difference of Gaussian (inhibitory , excitatory , kernel size=11)