Lecture 05 Expo

You might also like

Download as pdf
Download as pdf
You are on page 1of 14
Hough transform Te Hough transform (HT) is a method of ———- detecting regular shapes in an image and. | js a special case of the Radon transform, ‘The original method of line detection ‘was introduced in 1962 by Paul Hough and patented: P.V.C. Hough, "Method and means for recognizing complex pattems", US. | patent 3 069 654 (18.12.1962) This method was later generalized to L detect shapes that could be analytically described, eg. circles. Image Spece Perameter Space 2 ame Infinitely many straight lines pass through a single point (¥),%)) on the plane, and ‘each of these lines ean be deseribed by the equation: ret = mx —xy) ty) = mx + (}—- mm) y Each line passing through a point (s,.7) can be represented as a point in the parameter space m and b, because for all lines passing through a fixed point (x1) there is exactly one value b for a given value mm b xem yy Perameter Space Image Space in space xy corresponds to a line in space mb, ie in space Each point (bunch of line and vice versa ~ every point in space mb corresponds to a ‘The representation of straight lines in space mb, however, has a major disadvantage, namely in the case of vertical lines the parameters m and b assume an infinite valve. To solve this problem, the equation ofa line in polar form is used. Equation of a line in a polar coordinate system (1) 2 0 eos) x o=+ 45° — £090) y 4 2 Y= sin) * * nC) y ‘p~ distance of the straight line from the beginning pel Aa SI) system (the radial ‘of the coordinate ‘coordinate, radial distance or simply radius M and N ~ the number of | + perpendicular to the straight lin); poins (pels) of the image 4 — value of the directed angle between the halline OX Yetteally and horizontally, respectively (number of 97s and the radius vector (the angular coordinate, [SY Sjarme, ot the paced polar angle, or azimuth); -90° <9 <90° nats Equation of a a polar coordinate system (2) Each line passing through @ point (.',) can be represented as a point in the parameter space @ and p (Hough space). When the straight line is rotated around the point (71), the resulting lines £5 Lo, fy Ls form in the Hough space a set of points that ‘creates a sinusoidal curve. Each point (bunch of lines) in space x (image space) corresponds to a sinusoidal curve in space Oj (Hough space), while each point in space Gp corresponds toa line in space xy. na t fined \ Hough space a\_a\ Lia, If there are many points inthe image in space xy (image space), then in space 0p (Hough space) a set of sinusoidal curves associated with them is created. Points lying on the same line in the imag intersecting at one point in Hough space. space form a subset of sinusoidal curves ‘The coordinates of this point define the straight line located in the image. Original image ‘The accumulator concept(1) . Hough transform ofthe image 0 ° * bs 2 ~ 10 P . ao hs 10 , 0 Original image withthe marked line inal imagy 20 os 40 50 ° 50 ° 0 (degrees) ‘The accumulation of sinusoidal curves intersecting in space Jp (Hough space) can be interpreted as the existence of the line in space 1) (image space). p ‘The accumulator concept(2) 1 ceorresponds to the straight line: pi, -se0s(6,) +08.) ei > The space Gp (Hough space) is divided into accumulator cells and becomes a discrete space (there is a problem of quantization). > At the beginning all accumulator fi cells are reset to Zer0, > Each pixel (ry) in the original binary image is transformed into a discrete sinusoidal curve consisting of "ones" in the discrete space Jp. ‘The accumulator concept (3) ” a Each pixel (x) in the original binary image is transformed into a diserete sinusoidal curve consisting of "ones" in the diserete space dp. ® Sinusoidal curves are summed in the accumulator Comes" fiom dlfferent Sinusoidal curves re summed in individual accumulator cells). v ‘The pairs (0.p) comesponding to the accumulator cells with the largest values are interpreted as parameters deseribing the lines found in the original image. Hough transform properties ® v Each point of the image is considered independently ~> the possibility of parallel calculations. > Ability to recognize partially distorted lines (e.2. line with breaks), v ‘The method is not very sensitive to noise in the image, works well when processing images of poor quality. > The need to divide space My (Hough space) into accumulator cells (space quantization). The choice of quantization parameters is a compromise between the size of the accumulator matrix, the time of calculations and their accuracy. a Hough transform in Matlab (1) [H,theta,rho] = hough(imeomplement(IMAGE_BW). "RhoResolution’,0. > computing Hough transform of the binary image > H— Hough transform matrix (accumulator matrix) > theata and rho ~ vectors containing coordinates in Hough space (coordinates of accumulator cells) > IMAGE_BW- binary image > RhoResolution ~ resolution (intervals) between accumulator cells along the rho axis > Theta — vector of theta values of the accumulator cells (each element of the vector determines the theta value for the corresponding column of the accumulator matrix) Hough transform in Matlab (2) a peaks = houghpeaks(H,peak_number,..); > identification of maxima ("peaks") in the Hough transform matrix, » peaks — identified maxima ("peaks") in the Hough transform matrix > H—Hough transform matrix (accumulator matrix) > peak_number ~ the maximum number of peaks to identity lines = houghlines(imeomplement(IMAGE_BW),theta.rho,peaks... "FillGap'.20,’MinLength’'40); > extracting line segments based on Hough transform ® lines ~ extracted line segments in the image IMAGE_BW associated with individwal accumulator cells 2 theata and rho — vectors containing coordinates in Hough space (coordinates of accumulator cells) > peaks — identified maxima (“peaks”) in the Hough transform matrix > FillGap— when the distance between the line segments is less than the specified value, the line segments are merged into a single line > MinLength — lines shorter than the specified value are discarded Create Hough transform matrix hough a Hough transform in Matlab (3) Locate peaks in the Hough transform mati s houghpeaks Extract line segments ‘corresponding to peaks in the Hough ‘wansform matrix houghlines input image vy edge detection image Hough transform in Matlab (4) > +) Hough algorithm output image l | line drawing, f ZG = parameters of line segments Original image Edges FillGap.58 40 200 200 400 HIT matrix (1 peak) oa 0 0 cdenrees) 3 400 200 200) 400) 200, ° 0 (degrees) HT mat Original image Edges illGap.55, ry 7 HIT matrix (1 peak) Lines (3) a poo / no «fn AO 0 L. 400 | / Oo aE ots risa imap Ps ter matic ps Lines) = 200 x eo oe 7 Original image HIT matrix (3 peaks) 100 00 200 (degrees) Edges Lines 3) ° 0 (egrees) “50 ° 6 (degrees) HIT matrix 3 peaks) Vv Original image Fcdges UT matic 20 peas) Lines (20) 00 0 20 i eo 200 eo ‘0 bo & ?é 50 oO 30 ° ovaeteen 3 Oriinal image Face a) Lines (6 soo oa 1 . 20 0 0 0 a (degrees) Original image Fcdges HIT matrix (10 peaks) 7 (degrees) Lines (10) Original image Fues or AN TEA / SN =

You might also like