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!