Deleting objects from a binary image.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
rupam baruah
il 21 Mar 2016
Commentato: Image Analyst
il 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/158472/image.png)
0 Commenti
Risposta accettata
Matthew Eicholtz
il 21 Mar 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 Commenti
Image Analyst
il 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.
Più risposte (1)
Image Analyst
il 21 Mar 2016
You can use ismember() to extract the ones you want.
newBinaryImage = ismember(labeledImage, listOfBlobsToKeep) > 0;
0 Commenti
Vedere anche
Categorie
Scopri di più su Image Processing Toolbox in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!