adding noise to images
Show older comments
hi
i need to add x% noise ONLY to black areas of my image (image is grayscale) so x% of the black areas be replaced with white (changing 0 to 255)
Answers (1)
David Hill
on 15 Apr 2021
Edited: David Hill
on 15 Apr 2021
black=find(image==0);
white=randperm(length(black),floor(x/100*length(black)));
image(white)=uint8(255);
2 Comments
Kamyar Mazarei
on 15 Apr 2021
Edited: Kamyar Mazarei
on 15 Apr 2021
David Hill
on 15 Apr 2021
Edited: David Hill
on 15 Apr 2021
You could put in a range. My guess is that you think it is black but is not (==0).
black=find(image<10);%change range until you are satisfied.
Categories
Find more on Image Category Classification in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!