adding noise to images
1 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
回答(1 个)
David Hill
2021-4-15
编辑:David Hill
2021-4-15
black=find(image==0);
white=randperm(length(black),floor(x/100*length(black)));
image(white)=uint8(255);
2 个评论
David Hill
2021-4-15
编辑:David Hill
2021-4-15
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Convert Image Type 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!