Isolating circles and blobs as a mask in a binary image
Afficher commentaires plus anciens
I'm trying to isolate the large blobs/circles as a mask in the attached binary image. To get this image, I did use the imfill function to clean up the specific white areas, but I'm wondering how to isolate the large white areas by either size or solid-ness.
I did watch the Image Segmentation Tutorial and it was helpful as I incorporated pieces into my code, which is below. I utilized the regionprops function to get Area and Solidity information, and I am thinking that the ismember function may be the way to go. Although, I haven't been able to isolate the larger white areas. Any thoughts?
%%
% R = imfill(sliderBW, 'holes'); This is the attached image, defined in the workspace as 'R'
%%
R3 = regionprops(R, 'all'); % Using regionprops to get Area and Solidity
numberOfBlobs = size(R3, 1);
%%
% Below is filtering the Area; 15000 as a threshold was arbitrary
allBlobAreas = [R3.Area];
allowableAreaIndexes = (allBlobAreas > 15000);
keeperIndexes = find(allowableAreaIndexes);
keeperBlobsImage = ismember(R, keeperIndexes);
%Below is filtering the Solidity; 0.5 as a threshold was arbitrary
allBlobSolidity = [R3.Solidity];
allowableSolIndexes = (allBlobSolidity <0.5);
keeperIndexesSol = find(allowableSolIndexes);
keeperBlobsImageSol = ismember(R, keeperIndexesSol);
%%
maskedImage = R; % Re-defining image 'R' again
maskedImage(~keeperBlobsImage) = 0; % Area
maskedImage(~keeperBlobsImageSol) = 0; % Solidity
3 commentaires
KALYAN ACHARJYA
le 11 Fév 2021
Can you explain again?
What you have?
Desired result (You can use paint or any other image drawing tool)?
Aaron Devanathan
le 11 Fév 2021
Modifié(e) : Aaron Devanathan
le 11 Fév 2021
darova
le 11 Fév 2021
Once you have Area of each blob - sort area and choose a few biggest
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Blue dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

