instructor: mircea nicolescu lecture 12 cs 485 / 685 computer vision

Post on 16-Dec-2015

214 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Instructor: Mircea Nicolescu

Lecture 12

CS 485 / 685

Computer Vision

Line and Curve Detection

• The Hough Transform• Curve fitting• Deformable/active contours (Snakes)

2

3

The Hough Transform• The Hough Transform – can be used for line detection

− Consider the slope-intercept equation of a line:

y = ax + b

(a, b are constants, x is a variable, y is a function of x)

− Rewrite the equation as follows:

b = -xa + y(now, x, y are constants, a is a variable, b is a function of a)

4

The Hough Transform

• Properties:− Each point (xi , yi) defines a line in the a - b space (parameter space)

− Points lying on the same line in the x - y space, define lines in the parameter space which all intersect at the same point

− The coordinates of the point of intersection define the parameters of the line in the x - y space

y = ax + b b = -xa + y

5

The Hough Transform• Algorithm

− (line detection with slope-intercept representation)

6

The Hough Transform• Effects of quantization:

− The parameters of a line can be estimated more accurately using a finer quantization of the parameter space

− Finer quantization increases space and time requirements− For noise tolerance, however, a coarser quantization is better

(it is very likely that every point will cast a vote in the (a’, b’) cell)

7

The Hough Transform• Problem with slope-intercept equation:

− The slope can become very large or even infinite !!− It will be impossible to quantize such a large space

• Polar representation of lines

8

The Hough Transform

• Properties:

− Each point (xi , yi) defines a sinusoidal curve in the ρ-θ space (parameter space)

− Points lying on the same line in the x - y space define curves in the parameter space which all intersect at the same point

− The coordinates of the point of intersection define the parameters of the line in the x - y space

9

The Hough Transform• Example:

10

The Hough Transform• Algorithm

− (line detection with polar representation)

11

The Hough Transform• Example:

12

The Hough Transform• Extending the Hough Transform

− It can also be used for detecting circles, ellipses, etc.− For example, the equation of a circle is:

− In this case, there are three parameters: (x0, y0), r

− In general, we can use the Hough Transform to detect any curve which can be described analytically by an equation of the form:

− Detecting arbitrary shapes, with no analytical description, is also possible:

− Generalized Hough Transform

13

The Generalized Hough Transform

− The Hough transform was initially developed to detect analytically defined shapes (e.g., lines, circles, ellipses etc.).

− The generalized Hough transform can be used to detect arbitrary shapes (i.e., shapes having no simple analytical form).

− It requires the complete specification of the exact shape of the target object.

• The Generalized Hough Transform (GHT)

14

The Generalized Hough Transform• Special case: fixed

orientation and size

• Combine the above equations:

''

''

yyyoryyy

xxxorxxx

cc

cc

sin)sin(''

)sin(

cos)cos(''

)cos(

rryorr

y

rrxorr

x

15

The Generalized Hough Transform• Preprocessing step:

16

The Generalized Hough Transform• Detection:

17

The Generalized Hough Transform• General case

− Suppose the object has undergone some rotation θ and uniform scaling s:

− Replacing x’ by x” and y’ by y” we have:

18

The Generalized Hough Transform• Algorithm

− (general case)

19

The Generalized Hough Transform

• Advantages

− The generalized Hough transform is essentially a method for object recognition.

− It is robust to partial or slightly deformed shapes (i.e., robust to recognition under occlusion).

− It is robust to the presence of additional structures in the image (i.e., other lines, curves, etc.).

− It is tolerant to noise.− It can find multiple occurrences of a shape during the same

processing pass.

20

The Generalized Hough Transform

• Disadvantages

− It requires a lot of storage and extensive computation (but it is inherently parallelizable!).

− Faster variations have been proposed in the literature:

− Hierarchical representations− First match using a coarse resolution Hough array− Then selectively expand parts of the array having high matches

− Projections− Instead of having one high-dimensional array, store a few two

dimensional projections with common coordinates:

(e.g., (xc, yc), (yc, θ), (θ, s), (s, xc))

− Find consistent peaks in these lower dimensional arrays.

21

Curve Fitting• Approximation

− Compute a curve approximation that is not forced to pass through particular edge points.

− Approximation-based methods use all the edge points to find a good fit.

− Methods to approximate curves depend on the reliability with which edge points can be grouped into contours.

1) Least-squares regression can be used if it is certain that the edge points grouped together belong to the same contour.

2) Robust regression is more appropriate if there are some grouping errors.

22

Curve Fitting• Noise-free case

− Suppose the curve model we are trying to fit is described by the equation:

− In the noise-free case, it suffices to use p edge points to solve for the unknown parameters a1, a2, ..., ap

− In practice, we need to use all the edge points available to obtain good parameter estimates.

23

Curve Fitting• Least-squares line fit

− Linear regression fits a line to the edge points by minimizing the sum of squares of the perpendicular distances of the edge points from the line being fit.

n

iii yxE

1

2)sincos(

− Find ρ and θ that minimize E

24

Curve Fitting

n

iixn

x1

1

b

a2tan

• Least-squares line fit – cont.− The solution to the linear regression problem is:

where

and

where

sincos yx

n

iiyn

y1

1

n

iii yyxxa

1

))((2

n

ii

n

ii yyxxb

1

2

1

2 )()(

25

Curve Fitting• Least-squares line fit – cont.

− Problems with linear regression:− It works well for cases where the noise follows a Gaussian distribution.− It does not work well when there are outliers in the data (e.g., due to

errors in edge linking ).

26

Curve Fitting• Robust regression methods

− Outliers can pull the regression line far away from its correct location.

− Robust regression methods try various subsets of the data points and choose the subset that provides the best fit.

27

Curve Fitting• Robust regression methods – cont.

Midterm Review

• Image Formation and Representation• Image Filtering• Edge Detection• Math Review• Interest Point Detection• Line and Curve Detection

28

Image Formation and Representation

• Image formation (i.e., geometry + light)• Pinhole camera model• Effect of aperture size (blurring, diffraction)• Lens, properties of thin lens, thin lens equation • Focal length, focal plane, image plane,

focus/defocus (circle of confusion)• Depth of field, relation to aperture size• Field of view, relation to focal length

29

• Lens flaws (chromatic aberration, radial distortion, tangential distortion)

• Human eye (focusing, rods, cones)• Digital cameras (CCD/CMOS)• Image digitization (sampling, quantization) and

representation• Color sensing (color filter array, demosaicing,

color spaces, color processing)• Image file formats

Image Formation and Representation

30

Image Filtering

• Point/area processing methods

• Area processing methods using masks− how do we choose and normalize the mask weights?

• Correlation/convolution − Definition and geometric interpretation using dot product

• Noise modeling

31

Image Filtering

• Smoothing− Goal? Mask weights?− Effect of mask size?− Properties of Gaussian filter

− Convolution with self Gaussian width− Separability property and implications – proof

• Sharpening− Goal? Mask weights?− Effect of mask size?

2

32

Edge Detection

• What is an edge? What causes intensity changes?

• Edge descriptors (direction, strength, position)

• Edge models (step, ramp, ridge, roof)

• Mains steps in edge detection− Smoothing, Enhancement, Thresholding, Localization

33

Edge Detection

• Edge detection using derivatives:

− First derivative for edge detection− Min/max – why?

− Second derivative for edge detection− Zero crossings – why?

34

Edge Detection

• Edge detection masks by discrete gradient approximations (Robert, Sobel, Prewitt)− Study derivations− Gradient magnitude and direction− What information do they carry?− Isotropic property of gradient magnitude

• Practical issues in edge detection− Noise suppression-localization tradeoff− Thresholding− Edge thinning and linking

35

Edge Detection

• Criteria for optimal edge detection− Good detection/localization, single response

• Canny edge detector − What optimality criteria does it satisfy?− Steps and importance of each step− Main parameters

36

Edge Detection

• Laplacian edge detector− Properties− Comparison with gradient magnitude

• Laplacian of Gaussian (LoG) edge detector− Decomposition using 1D convolutions

• Difference of Gaussians (DoG)

37

Edge Detection

• Second directional derivative edge detector− Main idea

• Facet model− Main idea, steps

• Anisotropic filtering − Main idea

• Multi-scale edge detection− Effect of σ, coarse-to-fine edge localization

38

Math Review – Vectors

• Dot product and geometric interpretation• Orthogonal/orthonormal vectors• Linear combination of vectors• Space spanning• Linear independence/dependence• Vector basis• Vector expansion

39

Math Review – Matrices

• Transpose, symmetry, determinants• Inverse, pseudo-inverse• Matrix trace and rank• Orthogonal/orthonormal matrices• Eigenvalues/eigenvectors• Determinant, rank, trace etc. using eigenvalues• Matrix diagonalization and decomposition• Case of symmetric matrices

40

Math Review – Linear Systems

• Overdetermined/underdetermined systems

• Conditions for solutions of Ax=b− One solution− Multiple solutions− No solution

• Conditions for solutions of Ax=0− Trivial and non-trivial solutions

41

• SVD definition and meaning of each matrix involved

• Use SVD to compute matrix rank, inverse, condition

• Use SVD to solve Ax=b− Over-determined systems (m>n)− Homogeneous systems (b=0)

Math Review – SVD

42

• Translation, rotation, scaling− Need to remember equations

• Homogeneous coordinates• Composition of transformations• Rigid, similarity, affine, projective• Change of coordinate systems

Math Review – Geometric Transformations

43

Interest Point Detection

• Why are interest points useful?• Characteristics of “good” local features

− Local structure of interest points – gradient should vary in more than one direction

• Covariance and invariance properties• Corner detection

− Main steps − Methods using contour/intensity information

• Moravec detector − Main steps− Strengths and weaknesses

44

Interest Point Detection

• Harris detector− How does it improve the Moravec detector? − Derivation of Harris detector – grad students− Auto-correlation matrix

− What information does it encode? − Geometric interpretation?

− Computation of “cornerness”− Steps and main parameters

− Strengths and weaknesses

45

Interest Point Detection

• Multi-scale Harris-Laplace detector− Steps and main parameters− Strengths and weaknesses− Characteristic scale and spatial extent of interest points− Automatic scale selection

− How are the characteristic scale and spatial extent being determined using LoG?

− How and why do we normalize LoG’s response?

− Implement Harris-Laplace using DoG

46

Interest Point Detection

• Harris-Affine detector− Main idea, steps and parameters− Strengths and weaknesses

47

Line and Curve Detection

• Hough Transform− main ideas, steps, tradeoffs

− study very well - need to remember the steps of the algorithm

− Generalized Hough Transform

• Curve fitting− least-squares

− need to know how to derive and use equations

− robust regression methods

48

top related