Deleting objects from a binary image.

조회 수: 1 (최근 30일)
rupam baruah
rupam baruah 2016년 3월 21일
댓글: Image Analyst 2019년 4월 18일
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
Shikhar Ghimire
Shikhar Ghimire 2019년 4월 18일
It doesn't work on mine
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