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.
0 个评论
采纳的回答
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
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
2016-3-21
You can use ismember() to extract the ones you want.
newBinaryImage = ismember(labeledImage, listOfBlobsToKeep) > 0;
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!