To compute Hough space for vertical lines in Matlab, you can follow the steps below:
imread
functionmain.m33 chars2 lines
rgb2gray
functionmain.m26 chars2 lines
edge
functionmain.m36 chars2 lines
hough
function. For detecting vertical lines, you can set the 'Theta'
parameter to a vector of angles containing only 90 degrees (vertical lines).main.m50 chars2 lines
imshow
and the imagesc
functionsmain.m149 chars5 lines
The above lines of code display the Hough space with theta values on x-axis, rho values on y-axis, and the magnitude of the peaks representing the number of pixels that lie on a straight line in the original image.
Note: The Hough Transform technique is sensitive to noisy edges in the input image, so it is always better to pre-process the image by removing the noise before applying Hough Transform.
gistlibby LogSnag