I try to detect all lines in an image with some common geometric figures. The obvious choice,
hough of MATLAB wouldn't print out the desired results.
I used the following MATLAB code:
[H,T,R]=hough(BW); P=houghpeaks(H,10,'threshold',ceil(0.2*max(H(:)))); LINES=houghlines(BW,T,R,P,'FillGap',2,'MinLength',3); figure, imshow(BW),hold on; for k=1:length(LINES) xy=[LINES(k).point1; LINES(k).point2]; plot(xy(:,1),xy(:,2),'LineWidth',1,'Color','Green'); plot(xy(1,1),xy(1,2),'x','LineWidth',1,'Color','yellow'); plot(xy(2,1),xy(2,2),'x','LineWidth',1,'Color','red'); end
I think it is visible that
hough method did not detect every line leaving quiet a few still to be detected.
Does someone have a solution as to why it did not detect those lines and how to optimize the code so that it does detect them?