how to convert a gray level to another gray level in matlab?

3 vues (au cours des 30 derniers jours)
fariba amini
fariba amini le 4 Avr 2016
Commenté : fariba amini le 4 Avr 2016
i have an gray scale image.i want to change some gray level to another gray level.for example i want to convert all pixel with value 128 to 0 ,how can i do this?

Réponse acceptée

Walter Roberson
Walter Roberson le 4 Avr 2016
my_image =imread('YourImage.tif');
my_image(my_image == 128) = 0;
  1 commentaire
fariba amini
fariba amini le 4 Avr 2016
thank you so much.it works correctly.thanks again

Connectez-vous pour commenter.

Plus de réponses (1)

Muhammad Usman Saleem
Muhammad Usman Saleem le 4 Avr 2016
my_image =imread('YourImage.tif');
for R=1:num of Rows
for C=1:num of Columns
pixel=my_image(R,C);
if pixel ==128
pixel=0;
end
end
  1 commentaire
Walter Roberson
Walter Roberson le 4 Avr 2016
That will not save the result of the change to 0.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by