Detection of lines from an Image
2 views (last 30 days)
Show older comments
Image.Processor
on 6 Oct 2017
Commented: Walter Roberson
on 9 Oct 2017
Hello I have an image from which many lines are being dropping down from top to bottom.. some are straight and some are random. I have a code that works well but the problem is it detects only 10 to 15% of the lines from top to bottom and rest of them are just blank pixels nothing is detected. Can you suggest me what should I do to detect all the lines. PS: Image is very clear and lines are very clear on the image.
9 Comments
Accepted Answer
Image Analyst
on 8 Oct 2017
I'd first correct for the background by dividing by a blank one. If you can't do that then I'd try a bottom hat filter, imbothat(), or adapthisteq(), so that you can get to an image that you can threshold to get a binary image.
binaryImage = filteredImage < threshold;
Then I'd erode the binary image to get rid of the little lines and have just the big black thing at the top.
bigBlob = imerode(binaryImage, ones(5));
Then I'd use that to subtract from the original binary image so that now you're just left with a binary image of the fibers.
binaryImage = binaryImage & ~bigBlob;
Then I'd skeletonize them with bwmorph()
binaryImage = bwmorph(binaryImage, 'skel', inf);
and then call regionprops to get the area, which for skeletons is the length of the skeletonized line.
props = regionprops(binaryImage, 'Area');
allLengths = [props.Area];
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!