adding noise to images

1 Ansicht (letzte 30 Tage)
Kamyar Mazarei
Kamyar Mazarei am 15 Apr. 2021
Bearbeitet: David Hill am 15 Apr. 2021
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)

Antworten (1)

David Hill
David Hill am 15 Apr. 2021
Bearbeitet: David Hill am 15 Apr. 2021
black=find(image==0);
white=randperm(length(black),floor(x/100*length(black)));
image(white)=uint8(255);
  2 Kommentare
Kamyar Mazarei
Kamyar Mazarei am 15 Apr. 2021
Bearbeitet: Kamyar Mazarei am 15 Apr. 2021
thanks for the reply
but it works only to a small part of the image
like if i make x=100 it will remove only a small part of the image
the nosie isnt being added to the whole image
can you hlep please
thank you
David Hill
David Hill am 15 Apr. 2021
Bearbeitet: David Hill am 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Convert Image Type finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by