Download presentation
Presentation is loading. Please wait.
1
Hough transform and geometric transform
Jen-Chang Liu, Spring 20056
2
Motivation for edge linking
Edge detection: find pixels lying on edges => How to link edge points ? Sobel: horizontal Sobel: vertical original Goal:找出車牌方塊
3
Global processing Given n edge points in an image
=> Find subsets of the points that lie on straight lines Step 1: for a pair of points, determine their line function Step 2: determine whether there are points that are close to the line Step 3: repeat step 1 until all pair of points are tested
4
Global processing: complexity
n edge points n => C2 ~ n2 lines n => (n-2)C2 ~ n3 tests to determine whether other points are near this line Any faster method?
5
Hough transform Hough [1962] How to determine a line ? yi = axi + b
Tow point (xi, yi) and (xj, yj) determine a line (ak, bk) (a, b) yi = axi + b yj = axj + b Line with parameters (a, b) * Many lines pass a point * (xi, yi) and (xj, yj) both have a line with parameters (a, b) passing through
6
Idea: Parameter space of line
A line is determined by (a, b) B (ak, bk) (a, b) B = -Axi + yi (ak, bk) (a, b) yi = Axi + B B = -Axj + yj A
7
Example: find all lines [i.e. parameter (a,b)] pass a point
y a + b = 1 (a,b)=(, ?) (1,1) b (0,1) (a,b)=(1,0) (1,0) (a,b)=(0,1) x a Replace in y = ax+b 1 = a + b Problem: How to define the horizontal lines?
8
Problem with y=ax+b Solution for line function with slope a =
Normal representation of a line 垂直向量 Inner product = 0 (x, y)
9
Implementing Hough transform
1. decide on a discrete set of values of θ and to use 2. For each edge point, calculate the values of = xcosθ+ysinθfor all discrete θ 3. Create an accumulator array whose size are the number of angles θ and values 4. Updating the accumulator array as we go
10
Limit θ and 1. Restrict 0 y -3 3 x
11
Limit θ and (cont.) 2. -90θ180 Line in the 2nd quadrant
will not appear in the image y x
12
Example 128 128 128 -90 180
13
Example: Edge image: Gradient => threshold original
14
Project 2 Topic: Generalize Hough transform to detect circles
1-3 persons a team Prepare PowerPoint slides to explain your methods Write the MATLAB function to perform it Give me team members on 4/29 Present and demo on 5/6
15
Image rotation Rotation matrix (x’, y’) (x, y) θ
16
Real situation when rotating
Boundary of image changes Rotated pixels are not on the integer image grid
17
Real situation when rotating (cont.)
Take nearest integer grid What are the gray values? Rotated back and interpolation !!!
18
Gray-level interpolation
Nearest neighbor Bilinear interpolation Use 4 nearest neighbors Cubic convolution interpolation Fit a surface over a large number of neighbors
19
Interpolation 內插法 – 1D Nearest neighbor Linear interpolation
20
Interpolation 內插法 – 2D Bilinear interpolation Interpolate for (x,y’)
and (x+1, y’) first 2. Interpolate for (x’,y’)
21
High order interpolation
Cubic interpolation weighting f(x’)=R3(-1-)f(x1)+ R3(-)f(x2)+R3(1-)f(x3)+ R3(2-)f(x4)
22
Example: Anamorphosis
23
Spatial transformations
r(x,y) s(x,y) tiepoints f(x,y) g(x’,y’) distorted original
24
Spatial transformations (cont.)
Within the quadrilateral region, geometric transformation is modeled by a pair of bilinear equation 4 pairs of tiepoints to solve the equations Restored image:
25
Gray-level interpolation
Non-integer coordinate x’ or y’
26
Tiepoints after original distortion restored distorted
Nearest neighbor restored distorted Bilinear interp. restored distorted
27
original distorted (Using Previous Slide) restored Diff.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.