How to remove unconnected pixels or objects from an image

조회 수: 16 (최근 30일)
vidya
vidya 2014년 1월 21일
편집: DGM 2023년 2월 14일
good day all.. i have an image with many unconnected vessels..of pixels i want to remove those pixels how an i do it?

채택된 답변

Walter Roberson
Walter Roberson 2014년 1월 21일
bwareaopen()
See also bwmorph
  댓글 수: 5
Shri.s
Shri.s 2022년 12월 6일
use bwareaopen(BW); to remove unexpected things...
Image Analyst
Image Analyst 2022년 12월 6일
@Shri.s, yes this was mentioned by @Walter Roberson and tried by @vidya. Did you click the link to show the hidden comments? The original poster said "even after using bwareaopen there are still some unconnected pixels in my image".
Now, since then, we don't need the code I attached above, we can use bwareafilt. For example to extract the 3 largest blobs we can do
bw = bwareafilt(bw, 3);

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 2월 5일
OK, attached (below in blue text) is code that will get the largest network of vessels.
  댓글 수: 19
Quoc Anh Vu
Quoc Anh Vu 2022년 11월 29일
편집: DGM 2023년 2월 14일
Dear sir Image Analyst,
im working on extracting blood vessels on colposcopic image, but after segmentation, the result still has many unexpected objects, i want to keep structures i circled in below image, could you please help me to remove others , i've tried bwareafilt(), bwareaopen, but it didn't work. Thank you so much!
Image Analyst
Image Analyst 2022년 11월 29일
이동: DGM 2023년 2월 14일
I'm not sure what about the 30 or so blobs you want to keep is unique about them. Evidently you say it's not their size, or at least not their size alone.
If you want all blobs within a certain distance of the large blobs, perhaps you can use bwareafilt to extract the largest blobs and then dilate the large blobs to get a larger region around them, then erase use imreconstruct to extract those blobs inside or connected to the large blob. Something like
se = strel('disk', 200, 8);
bigMask = imdilate(mask, se);
newMask = imreconstruct(bigMask, mask);

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Retinal Imaging에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by