Binary image morphological operation for complete broken lines
1 view (last 30 days)
Show older comments
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 :
original image
after subtract
PLEASE HELP. thanks
0 Comments
Accepted Answer
Image Analyst
on 26 Jun 2016
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 Comments
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!