Download presentation

Presentation is loading. Please wait.

Published byJuliana Marquis Modified over 2 years ago

1
Image Transforms 主講人：虞台文

2
Content Overview Convolution Edge Detection – Gradients – Sobel operator – Canny edge detector – Laplacian Hough Transforms Geometric Transforms – Affine Transform – Perspective Transform Histogram Equalization

3
Image Transforms Overview

4
Image Transform Concept T[]

5
Image Transform Concept T[]

6
Image Transforms Convolution

7
Image Convolution g(x,y) is known as convolution kernel.

8
Image Convolution g(x,y) is known as convolution kernel. height 2h + 1 width 2w + 1

9
Image Convolution g(x,y) is known as convolution kernel. height 2h + 1 width 2w + 1

10
Some Convolution Kernels

11
OpenCV Implementation Image Filter void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1, -1) ); void cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel, CvPoint anchor=cvPoint(-1, -1) );

12
Deal with Convolution Boundaries void cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, int bordertype, CvScalar value=cvScalarAll(0) ); void cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset, int bordertype, CvScalar value=cvScalarAll(0) );

13
Image Transforms Edge Detection

14
Convert a 2D image into a set of curves – Extracts salient features of the scene – More compact than pixels

15
Origin of Edges depth discontinuity surface color discontinuity illumination discontinuity surface normal discontinuity Edges are caused by a variety of factors

16
Edge Detection How can you tell that a pixel is on an edge?

17
Edge Types Step Edges Roof Edge Line Edges

18
Real Edges Noisy and Discrete! x I We want an Edge Operator that produces: – Edge Magnitude – Edge Orientation – High Detection Rate and Good Localization

19
Derivatives of Image in 1D Edges can be characterized as either: – local extrema of I(x) – zero-crossings of 2 I(x) 1D image gradient Laplacian

20
2D-Image Gradient

21
Gives the direction of most rapid change in intensity Gradient direction: Edge strength:

22
Classification of Points To precisely locate the edge, we need to thin. Ideally, edges should be only one point thick. T Non-zero edge width

23
The Sobel Operators 01 -202 01 121 000 -2 Sobel (3 x 3): Sobel (5 x 5): -2021 -3032 -5053 -2-3032 -2021 12321 23532 00000 -3-5-3-2 -2-3-2 Good Localization Noise Sensitive Poor Detection Poor Localization Less Noise Sensitive Good Detection

24
OpenCV Implementation The Sobel Operators void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 );

25
OpenCV Implementation The Scnarr Operator void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size = 3 ); aperture_size CV_SCHARR

26
Demonstration

27
Exercise Download Test Program Download Test Program

28
Effects of Noise Where is the edge? Consider a single row or column of the image

29
Solution: Smooth First

30
Where is the edge?

31
Derivative Theorem of Convolution Gaussian:

32
Derivative Theorem of Convolution saves us one operation.

33
Optimal Edge Detection: Canny Assume: – Linear filtering – Additive iid Gaussian noise An "optimal" edge detector should have: – Good Detection Filter responds to edge, not noise. – Good Localization detected edge near true edge. – Single Response one per edge.

34
Optimal Edge Detection: Canny Based on the first derivative of a Gaussian Detection/Localization trade-off – More smoothing improves detection – And hurts localization.

35
Stages of the Canny algorithm Noise reduction Size of Gaussian filter Finding the intensity gradient of the image Non-maximum suppression Tracing edges through the image and hysteresis thresholding High threshold Low threshold

36
Parameters of Canny algorithm Noise reduction – Size of Gaussian filter Finding the intensity gradient of the image Non-maximum suppression Tracing edges through the image and hysteresis thresholding – High threshold – Low threshold

37
OpenCV Implementation The Canny Operator void cvCanny( const CvArr* img, CvArr* edges, double lowThresh, double highThresh, int apertureSize = 3 ); void cvCanny( const CvArr* img, CvArr* edges, double lowThresh, double highThresh, int apertureSize = 3 );

38
Example: Canny Edge Detector Download Test Program Download Test Program

39
Review: Derivatives of Image in 1D Edges can be characterized as either: – l– local extrema of I(x) – z– zero-crossings of 2 I(x) 1D image gradient Laplacian

40
Laplacian A scalar isotropic. Edge detection: Find all points for which 2 I(x, y) = 0 No thinning is necessary. Tends to produce closed edge contours.

41
Laplacian

42
Discrete Laplacian Operators

43
OpenCV Implementation The Discrete Laplacian Operators void cvLaplace( const CvArr* src, CvArr* dst, int apertureSize = 3 ); void cvLaplace( const CvArr* src, CvArr* dst, int apertureSize = 3 );

44
Example

45
Laplician for Edge Detection Find zero-crossing on the Laplacian image.

46
Zero Crossing Detection There is a little bug in the above algorithm. Try to design your own zero-crossing detection algorithm.

47
Example: Laplician for Edge Detection Download Test Program Download Test Program

48
Laplacian for Image Sharpening

49
Example: Laplacian for Image Sharpening Sharpened Image

50
Laplacian of Gaussian (LoG) Gaussian:

51
Some LoG Convolution Kernels

52
Example: LoG for Edge Detection by LoG by Laplacian

53
Image Transforms Hough Transforms

54
Goal of Hough Transforms A technique to isolate the curves of a given shape / shapes in a given image Classical Hough Transform – can locate regular curves like straight lines, circles, parabolas, ellipses, etc. Generalized Hough Transform – can be used where a simple analytic description of feature is not possible

55
HT for Line Detection x y m b (m, b) A line in xy-plane is a point in mb-plane.

56
HT for Line Detection x y m b (m 1, b 1 ) (m 2, b 2 ) (m 3, b 3 ) All lines passing through a point in xy-plane is a line in mb-plane. A line in xy-plane is a point in mb-plane.

57
HT for Line Detection x y m b (m 1, b 1 ) (m 2, b 2 ) (m 3, b 3 ) All lines passing through a point in xy-plane is a line in mb-plane. A line in xy-plane is a point in mb-plane. Given a point in xy-plane, we draw a line in mb-plane.

58
HT for Line Detection x y m b A line in xy-plane is a point in mb-plane. A line in xy-plane is then transformed in to a set of lines in mb-plane, which intersect at a common point. Given a point in xy-plane, we draw a line in mb-plane. (m, b)

59
HT for Line Detection x y m b A line in xy-plane is a point in mb-plane. A line in xy-plane is then transformed in to a set of lines in mb-plane, which intersect at a common point. Given a point in xy-plane, we draw a line in mb-plane. (m, b) How to implement? Is mb representation suitable?

60
HT Line Detection by -representation x y ( , ) A line in xy-plane is a point in -plane.

61
HT Line Detection by -representation x y A line in xy-plane is a point in -plane. 1 2 3 4 4 3 2 1 All lines passing through a point in xy-plane is a curve in -plane.

62
HT Line Detection by -representation x y A line in xy-plane is a point in -plane. 1 2 3 4 4 3 2 1 All lines passing through a point in xy-plane is a curve in -plane. Given a point in xy-plane, we draw a curve in -plane.

63
HT Line Detection by -representation x y A line in xy-plane is a point in -plane. Given a point in xy-plane, we draw a curve in -plane. A line in xy-plane is then transformed in to a set of curves in -plane, which intersect at a common point. ( , )

64
HT Line Detection by -representation A line in xy-plane is a point in -plane. Given a point in xy-plane, we draw a curve in -plane. A line in xy-plane is then transformed in to a set of curves in -plane, which intersect at a common point.

65
OpenCV Implementation Hough Line Transform CvSeq* cvHoughLines2( CvArr* image, void* line_storage, int method, double rho, double theta, int threshold, double param1 = 0, double param2 = 0 ); CvSeq* cvHoughLines2( CvArr* image, void* line_storage, int method, double rho, double theta, int threshold, double param1 = 0, double param2 = 0 );

66
Example: Hough Line Transform Download Test Program Download Test Program

67
Hough Circle Transform Circle equation: x y r a b image spaceparameter space

68
Hough Circle Transform Circle equation: x y r a b image spaceparameter space Cost ineffective & time consuming

69
Hough Gradient Method Circle equation: x y image space Parametric form:

70
Hough Gradient Method Circle equation: x y image space Parametric form: The value of can be obtained from the edge detection process.

71
Hough Gradient Method Quantize the parameter space for the parameters a and b. Zero the accumulator array M(a, b). Compute the gradient magnitude G(x, y) and angle (x, y). For each edge (x 0, y 0 ) point in G(x, y), increment all points in the accumulator array M(a, b) along the line Local maxima in the accumulator array correspond to centers of circles in the image. Circle equation: x y image space

72
OpenCV Implementation Hough Circle Transform CvSeq* cvHoughCircles( CvArr* image, void* circle_storage, int method, double dp, double min_dist, double param1=100, double param2=100 int min_radius=0, int max_radius=0 ); CvSeq* cvHoughCircles( CvArr* image, void* circle_storage, int method, double dp, double min_dist, double param1=100, double param2=100 int min_radius=0, int max_radius=0 );

73
Example: Hough Circle Transform Download Test Program Download Test Program

74
Image Transforms Geometric Transforms

75
Geometric Transforms Stretch, Shrink, Warp, and Rotate

76
Scaling, Rotation, Translation Scaling Rotation Translation

77
Scaling, Rotation + Translation Scaling Rotation Translation + Translation + Translation

78
Homogeneous Coordinate

79
Scaling, Rotation + Translation Scaling Rotation + Translation + Translation 2 3 matrix

80
Affine Transformation An affine transformation is any transformation that can be expressed in the form of a matrix multiplication followed by a vector addition. – In OpenCV the standard style of representing such a transformation is as a 2-by-3 matrix. 2 3 matrix

81
Affine Transformation

82
GetAffineTransform

84
Get 2D Rotation Matrix

85
WarpAffine

86
GetQuadrangleSubPix

87
Example: Affine Transform Download Test Program Download Test Program

88
GetQuadrangleSubPix

89
Sparse Affine Transformation

90
Perspective Transform

93
Affine Transform vs. Perspective Transform Affine Transform: Perspective Transform:

94
Get Perspective Transform

95
WarpPerspective

96
Sparse Perspective Transformation

97
Image Transforms Histogram Equalization

98
Graylevel Histogram of Image

99
Goal of Histogram Equalization

100
Image Enhancement

101
Method Graylevel Remapping 0 1 fX(x)fX(x) x 0 1 fY(y)fY(y) y y x X Y

102
Probability Theory y x X Y pdf cdf

103
Example: Gaussian

105
Demonstration

106
OpenCV Implementation

107
Example Download Test Program Download Test Program

Similar presentations

OK

EDGE DETECTION Presentation by Sumit Tandon Department of Electrical Engineering University of Texas at Arlington Course # EE6358 Computer Vision.

EDGE DETECTION Presentation by Sumit Tandon Department of Electrical Engineering University of Texas at Arlington Course # EE6358 Computer Vision.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on kingdom monera characteristics Ppt on grease lubrication manifold Ppt on cloud computing in e-learning Water saving tips for kids ppt on batteries Ppt on end of life care Ppt on importance of sports and games Ppt on renewable resources Ppt on environment and development Ppt on sexually transmitted diseases Ppt on bluetooth protocol architecture