Q2.3 The Hough transform (20 points) Write a function that applies the Hough Transform to an edge magnitude image. Dis-
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Q2.3 The Hough transform (20 points) Write a function that applies the Hough Transform to an edge magnitude image. Dis-
Q2.3 The Hough transform (20 points)Write a function that applies the Hough Transform to an edgemagnitude image. Dis-play the output for one of the images in the write-up.function [H, rhoScale, thetaScale] = myHoughTransform(Im,threshold,rhoRes,thetaRes)Im is the edge magnitude image, threshold (scalar) is a edgestrength threshold used toignore pixels with a low edge lter response. rhoRes (scalar) andthetaRes (scalar) are the resolution of the Hough transformaccumulator along the and axes respectively. H is the Houghtransform accumulator that contains the number of \votes" for allthe possible lines passing through the image. rhoScale andthetaScale are the arrays of and values over which myHoughTransformgenerates the Hough transform matrix H. For example, if rhoScale(i)= i and thetaScale(j) = i, then H(i,j) contains the votes for = iand = i. First, threshold the edge image. Each pixel (x; y) abovethe threshold is a possible point on a line and votes in the Houghtransform for all the lines it could be a part of. Parametrizelines in terms of and such that = x cos + y sin , 2 [0; 2] and 2[0;M]. M should be large enough to accommodate all lines that couldlie in an image. Each line in the image corresponds to a uniquepair (; ) in this range. Therefore, values corresponding tonegative values are invalid, and you should not count those votes.The accumulator resolution needs to be selected carefully. If theresolution is set too low, the estimated line parameters might beinaccurate. If resolution is too high, run time will increase andvotes for one line might get split into multiple cells in thearray. Your code cannot call Matlab's hough function, or any othersimilar functions. You may use hough for comparison and debugging.A sample visualization of H is shown in Figure 2.