How to extract second largest blob from image?

조회 수: 6 (최근 30일)
Roark Menezes
Roark Menezes 2020년 6월 16일
편집: KALYAN ACHARJYA 2020년 6월 18일
I have a binary image, and have extracted the largest and second largest images from a grayscale image (using bwareafilt). This gives me the image below:
How do i extract the image on the right (the second largest image)?
Using regionprops I have the Area, Centroid and Bounding Box for both blobs, but I am not sure how to use these values to extract the image on the right.
Thank you.
  댓글 수: 4
Roark Menezes
Roark Menezes 2020년 6월 18일
How would I remove the larger image knowing just the area?
KSSV
KSSV 2020년 6월 18일
Replace that region pixel values with black ones....

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

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2020년 6월 18일
편집: KALYAN ACHARJYA 2020년 6월 18일
large_1=bwareafilt(binary_image,1); %Extracting Large Blob
large_2=binary_image & ~large_1; % Logical Operation to get 2nd largest Blob
large_2=bwareafilt(large_2,1); % Remove extra small blobs
imshow(large_2);

Community Treasure Hunt

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

Start Hunting!

Translated by