Binary image morphological operation for complete broken lines
5 次查看(过去 30 天)
显示 更早的评论
Hello there, How can i complete these Broken lines using morphological operation on binary image, and after that count the lines. I've got this image from subtracting circles from original image as shown :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154468/image.jpeg)
original image
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154470/image.jpeg)
after subtract
PLEASE HELP. thanks
0 个评论
采纳的回答
Image Analyst
2016-6-26
You have to label the "original" binary image:
[labeledImage, numRegions] = bwlabel(binaryImage);
Then you have to call regionprops() on the subtracted image and ask for the 'Centroid', 'MajorAxisLength' and 'MinorAxisLength'. Then for each centroid, examine the labeled image and see if the other centroids have the same label. If they do, then they were part of the original blob and got broken into two or more parts. So you'd have to reconnect them in the subtraction image with lines. I attach a demo for burning a line into an image.
Now the regions are connected again but you may have crossed lines. To find lines that are crossed, like X, or connected at the ends, like L or T or E. To find crossed lines, call bwmorph() and ask for endpoints. To find shapes like L, T or E, examine the ratio of major axis length to minor axis length.
See my Image Segmentation Tutorial if you need more guidance. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!