Detection of lines from an Image
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Image Analyst
2017-10-8
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];
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!