フィルターのクリア

How to delete an object without a dot on it?

2 ビュー (過去 30 日間)
W Joey
W Joey 2015 年 7 月 2 日
回答済み: Image Analyst 2015 年 7 月 2 日
Hi, I am trying to extract the mobile phone, with a dot on it, out of the image. I have detected the edge of the phone. But beside the phone there is a cap without a dot, which I don't want. How should I delete the image of the cap and extract only the phone? I have already got the coordinate of the dot center.

採用された回答

Thorsten
Thorsten 2015 年 7 月 2 日
編集済み: Thorsten 2015 年 7 月 2 日
You can use bwlabel to label the binary image,
L = bwlabel(I);
then get the label of the phone using the coordinates of the red dot, create an empty image the size of the original one, and then set only the pixels in the new image that match the label of the phone to 1:
Inew = zeros(size(I));
Inew(L==L(y_red, x_red)) = 1;
  1 件のコメント
W Joey
W Joey 2015 年 7 月 2 日
cool!Thanks a lot!

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2015 年 7 月 2 日
You need to find the red spot(s) first and get a binary image of those. See my File Exchange if you need to know how to do that. Then use that binary image with imreconstruct() and your filled binary image.
binaryWitDots = imreconstruct(filledBinaryImage, redDotBinary);

Community Treasure Hunt

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

Start Hunting!

Translated by