Small objects not being removed using bwareaopen()
Afficher commentaires plus anciens
I am using the function:
bwareaopen(Image, minPixels)
on the following image:

It should remove all of the objects in my binary image which are less than a specified number of pixels (minPixels). However, it seems to be consistently missing some that are smaller than that range. The following figure shows the original image and the one after bwareaopen() is applied.

The issues are the same for minPixel < 100000. It turns the image completely black expectedly at higher orders of magnitude.
Below is the code I am using. Thanks for any help!
image = imread('Gaussian.jpg'); % load in your image
binaryImage = im2bw(image, 0.5); % converts image to binary file
BW2 = bwareaopen(binaryImage, 150); % removes objects comprised of < 150 pixels
imshowpair(binaryImage, BW2, 'montage') % display both images to see if spots are removed
(Documentation for bwareaopen can be found at: https://www.mathworks.com/help/images/ref/bwareaopen.html)
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Modify Image Colors 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!