Download - Hough transform and geometric transform
Hough transform and geometric transform
Jen-Chang Liu, Spring 20056 Motivation for edge linking
Edge detection: find pixels lying on edges => How to link edge
points ? Sobel: horizontal Sobel: vertical original Goal: 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 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? 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 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 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? Problem with y=ax+b Solution for line function
with slope a =
Normal representation of a line Inner product = 0 (x, y)
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+ysinfor all discrete 3.
Create an accumulator array whose size are the number of angles and
values 4. Updating the accumulator array as we go Limit and 1.
Restrict 0 y -3 3 x Limit and (cont.) 2. -90180 Line in the 2nd
quadrant
will not appear in the image y x Example 128 128 128 -90 180
Example: Edge image: Gradient => threshold original 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 Image rotation Rotation
matrix (x, y) (x, y) Real situation when rotating
Boundary of image changes Rotated pixels are not on the integer
image grid Real situation when rotating (cont.)
Take nearest integer grid What are the gray values? Rotated back
and interpolation !!! Gray-level interpolation
Nearest neighbor Bilinear interpolation Use 4 nearest neighbors
Cubic convolution interpolation Fit a surface over a large number
of neighbors Interpolation 1D Nearest neighbor Linear interpolation
Interpolation 2D Bilinear interpolation Interpolate for (x,y)
and (x+1, y) first 2. Interpolate for (x,y) High order
interpolation
Cubic interpolation weighting f(x)=R3(-1-)f(x1)+
R3(-)f(x2)+R3(1-)f(x3)+ R3(2-)f(x4) Example: Anamorphosis Spatial
transformations
r(x,y) s(x,y) tiepoints f(x,y) g(x,y) distorted original 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: Gray-level interpolation
Non-integer coordinate x or y Tiepoints after original distortion
restored distorted
Nearest neighbor restored distorted Bilinear interp. restored
distorted original distorted (Using Previous Slide) restored
Diff.