erosion only pixels with value 50 and 51 in grayscale image
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a grayscale image with pixels values 2, 3, 4, 50 and 51. I need to erode only a pixels with value 50 and 51(it represents the clouds). The result should be picture with pixels values 2,3 and 4. Can you please help me with this.
0 commentaires
Réponse acceptée
Image Analyst
le 28 Mar 2016
Try this:
windowSize = 3; % Whatever you want
erodedImage = imerode(grayImage, true(windowSize));
% Get map of where the 50 and 51 are
mask = grayImage >= 50;
% Replace only those locations with the eroded pixels.
grayImage(mask) = erodedImage(mask);
Of course, you will still have 50 and 51 in the output image if those regions are larger than your mask regions.
3 commentaires
Image Analyst
le 28 Mar 2016
You did something wrong. I just tried it and it works. See my attached demo. Then attach your demo.
Plus de réponses (0)
Voir également
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!