문제

How to detect almost straight lines in an image using MATLAB? Hough Transform not able to detect the lines properly, as lines are not exactly smooth. And, is there any way to detect all the rectangles in the image or thick lines (assume same color rectangle as a thick line)?? Here is the image enter image description here

도움이 되었습니까?

해결책

Apply canny edge detector to the image and do a labeling and you'll detect most of the rectangles.

rgb : the image

edges = edge(rgb2gray(rgb), 'canny');

labels = label2rgb(bwlabel(edges, 8));

figure, imshow(edges)

figure, imshow(labels)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top