Page 1 of 1

Q2.4 Finding lines (15 points) Write a function that uses the Hough transform output to detect lines, function [rhos, th

Posted: Fri Jul 01, 2022 6:15 am
by answerhappygod
Q2.4 Finding lines (15 points) Write a function that uses theHough transform output to detect lines, function [rhos, thetas] =myHoughLines(H, nLines) 5 where H is the Hough transformaccumulator, and nLines is the number of lines to return. Outputsrhos and thetas are both nLines1 vectors that contain the row andcolumn coordinates of peaks in H, that is, the lines found in theimage. Ideally, you would want this function to return the andcoordinates for the nLines highest scoring cells in the Houghaccumulator. But for every cell in the accumulator corresponding toa real line (likely to be a locally maximal value), there willprobably be a number of cells in the neighborhood that also scoredhigh but should not be selected. These non maximal neighbors can beremoved using non maximal suppression. Note that this non maximalsuppression step is dierent from the one performed earlier. Hereyou will consider all neighbors of a pixel, not just the pixelslying along the gradient direction. You can either implement yourown non maximal suppression code or nd a suitable function on theInternet (you must acknowledge and cite the source in your write-up, as well as hand in the source in your matlab/ directory).Another option is to use Matlab function imdilate. Once you havesuppressed the non maximal cells in the Hough accumulator, returnthe coordinates corresponding to the strongest peaks in theaccumulator. Your code can not call on Matlab's houghpeaks functionor other similar functions. You may use houghpeaks for comparisonand debugging.