1 Hough Transform
2 A Technique to Isolate Features of a Particular Shape within an Image The classical Hough transform is most commonly used for the detection of regular curves such as: lines, circles, ellipses, etc Because: The desired features be specified in some parametric form
Voting schemes 3 Let each feature vote for all the models that are compatible with it Hopefully the noise features will not vote consistently for any single model Missing data doesn’t matter as long as there are enough features remaining to agree on a good model
Properties 4 Can tolerate noise and gaps in edge image Look for solutions in a parameter space Classical Hough transform Detect simple shape Line detection Circle detection
Hough transform 5 An early type of voting scheme General outline: Discretize parameter space into bins For each feature point in the image, put a vote in every bin in the parameter space that could have generated this point Find bins that have the most votes
Hough Transform شنبه زاده 6 Instead of going directly for the solution (as in template matching), we can use a voting scheme. Each possible point (edge) votes in the parameter space of a line. A line can be specified uniquely by two parameters m and n. y = m.x + n Parameter space of 2 dimensions (m and n).
7 y x b m m0m0 b0b0 Hough spaceimage space Connection between image (x,y) and Hough (m,b) spaces A line in the image corresponds to a point in Hough space To go from image space to Hough space: - given a set of points (x,y), find all (m,b) such that y = mx + b Finding lines in an image A line in the image corresponds to a point in Hough space
8 Where is the line that contains both (x 0, y 0 ) and (x 1, y 1 )?
9 It is the intersection of the lines b = –x 0 m + y 0 and b = – x 1 m + y 1
10 Equation of Line: Find: Consider point: Image Space Parameter space also called Hough Space Parameter Space
11 Algorithm: Quantize Parameter Space Create Accumulator Array Set For each image edge increment: If lies on the line: Find local maxima in Parameter Space
شنبه زاده 12 Problem with m-n parameter space. Both m and n can get very large [-∞, ∞]. How do we address this problem?
13 An alternative parameter space is polar coordinates. We use ( ρ, θ ) space to represent a line. ρ = x.cos( θ ) + y.sin( θ ) Points in picture sinusoids in parameter space Points in parameter space lines in picture Sinusoids corresponding to co-linear points intersect at an unique point
14 Example: Line: 0.6x + 0.4y = 2.4 Sinusoids intersect at:ρ = 2.4, θ =
شنبه زاده 15 Let ρ= [−R, R] and θ= [0,pi ) For each edge point (xi, yi ), calculate: θ ‘ = xi cos θ ‘+ yi sin θ Accumulator: A(ρ, θ) = A(ρ, θ) + 1 Threshold the accumulator values to get parameters for detected lines Threshold at A(ρ, θ) = 30 Threshold at A(ρ, θ) = 20 Threshold at A(ρ, θ) = 15
Example 16
Hough Transform Example with breaks in lines 17
Hough Transform Example with 1% salt and pepper noise 18
The Hough transform of the line is simply: a point at coordinate (ρ,θ) 19
A family of lines passing through a common point 20
The Hough transform of the family of curves passing through the three points results in the set of three parametric curves. These three curves cross at a single point corresponding to the dashed line passing through the collinear points. 21
22
23
24
25
Example 26
27
28 Theta = 45º = rad r = (1√2) / 2 = Theta: 0 to 3.14 (rad) Tokens Votes Brightest point = 20 votes
29 Brightest point = 6 votes
30 Noise Lowers the Peaks
31 Noise Increases the Votes in Spurious Accumulator Elements
( e) Straight dashed line ( f) Hough transform of dashed line 32
33
34 Edges need not be connected Complete object need not be visible Key Idea: Edges VOTE for the possible model Advantages
35 1)Exponential time and memory increase with the increase of the parameter numbers. 2) Sampling of parameter space is difficult. 3) Similar shapes might produce peaks in the Hough Space (wide ellipses might interfere with lines) Problems with HT
A city scene where the buildings are obstructed in fog 36
To find the true edges of the buildings 37
Hough transform can detect some of the straight lines representing building edges within the obstructed region The histogram equalizedhistogram equalized accumulator space شنبه زاده 38
De-Houghed image set the relative threshold to 70% 39
Relative Threshold 50% 40
Street information is not available 41
Hough line detector is able to recover some of this information 42
شنبه زاده 43 Hough Transform By MATLAB I = imread('circuit.tif'); BW = edge(I,'canny'); [H,T,R] = hough(BW); P = houghpeaks(H,12,'threshold',ceil(0.3*max(H(:)))); lines = houghlines(BW,T,R,P,'FillGap',5,'MinLength',7);
شنبه زاده 44
Hough transform for circles 45
Hough transform for circles 46
47
Implementation of the Hough transform for circles 48
شنبه زاده 49
شنبه زاده 50
آلگوريتم زير را از صفحه 206 کتاب استخراج ويژگی های تصوير مطالعه نموده و برای يک تصوير چهره عنبيه را مشخص سازيد. 51
Hough transform for ellipses 52
Circles are very important in shape detection since many objects have a circular shape. However, because of the camera’s viewpoint, circles do not always look like circles in images. We can define the mapping between the circle and an ellipse by a similarity transformation. 53
54
با توجه به وجود 5 پارامتربرای محاسبات اگر 100 حالت برای هر کدام از آنها وجود داشته باشد، حافظه مورد نياز برای ذخيره سازی را محاسبه نماييد. 55
56
57
58
59