Deleting objects from a binary image.

1 次查看(过去 30 天)
Hello everyone. I have a binary image with different objects. In the image I want to remove 5th, 13th, and 20th objects. How can I remove it. Thnks.

采纳的回答

Matthew Eicholtz
Matthew Eicholtz 2016-3-21
L = bwlabel(bw); %where bw is your binary image
bw2 = bw; %copy of binary image
bw2(L==5) = 0; %deletes the 5th object
  2 个评论
Image Analyst
Image Analyst 2019-4-18
Try my answer below. If that doesn't work, explain more in a new question, and attach your image. And say which blob you want to delete.

请先登录,再进行评论。

更多回答(1 个)

Image Analyst
Image Analyst 2016-3-21
You can use ismember() to extract the ones you want.
newBinaryImage = ismember(labeledImage, listOfBlobsToKeep) > 0;

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by