Detection of lines from an Image

2 ビュー (過去 30 日間)
Image.Processor
Image.Processor 2017 年 10 月 6 日
コメント済み: Walter Roberson 2017 年 10 月 9 日
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.Processor
Image.Processor 2017 年 10 月 8 日
@Walter Roberson.. Yes you are right, I will make an assumption that the lines are continues and there are no sharp breaks or else I will try to fit some points where there are breaks. But as I said in my above comment for now I am concerned with the lengths of lines until they are pretty straight.
Walter Roberson
Walter Roberson 2017 年 10 月 9 日
Unfortunately the sample image appears to have disappeared.

サインインしてコメントする。

採用された回答

Image Analyst
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];
  2 件のコメント
Image.Processor
Image.Processor 2017 年 10 月 8 日
Thanks I would check that and surely will come back to you with further question and to accept your answer :)
Image.Processor
Image.Processor 2017 年 10 月 9 日
Hi Image Analyst. I have tried a lot but I can not find the way to get that. Is it possible for you to give me a sample code for what you explained. I am new may be I am making a lots of mistakes. Thank you so much.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by