How to manually remove certain blobs from image?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I get the following image or very similar images back from my Image Segmentation. I have all the blobs numbered and labled. Now I want to add the possibility to delete every blob I want by entering its number in a text field. The criteria to keep or delete a blob are not fixed so as far as I am concerned no region function will work.
0 commentaires
Réponses (1)
Image Analyst
le 21 Jan 2019
You can use bwselect() or ismember()
labelsPresent = unique(labeledImage(:));
labelsToKeep = setdiff(labeledPresent, labelIndexToDelete);
binaryImage = ismember(labeledImage, labelsToKeep);
labeledImage = bwlabel(binaryImage);
2 commentaires
Image Analyst
le 3 Fév 2019
You can use ginput(). Something like
uiwait(helpdlg('Click on the blob to delete'));
[column, row] = ginput(1);
pixelValue = labeledImage(row, column); % Get the label of the blob they clicked on.
mask = ismember(labeledImage, pixelValue); % Extract this one blob.
% Remove it from the labeled image.
labeledImage(mask) = 0;
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!