Deleting objects from a binary image.

2 Ansichten (letzte 30 Tage)
rupam baruah
rupam baruah am 21 Mär. 2016
Kommentiert: Image Analyst am 18 Apr. 2019
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.

Akzeptierte Antwort

Matthew Eicholtz
Matthew Eicholtz am 21 Mär. 2016
L = bwlabel(bw); %where bw is your binary image
bw2 = bw; %copy of binary image
bw2(L==5) = 0; %deletes the 5th object
  2 Kommentare
Shikhar Ghimire
Shikhar Ghimire am 18 Apr. 2019
It doesn't work on mine
Image Analyst
Image Analyst am 18 Apr. 2019
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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

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

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by