histogram doesn't work for .png images?

9 vues (au cours des 30 derniers jours)
Lulu Firdaus
Lulu Firdaus le 7 Mai 2020
Commenté : Lulu Firdaus le 8 Mai 2020
hello everyone. I am having trouble with displaying histogram for .png image. the image is grayscale already, so I just use this code.
I=imread('38_training.png');
figure,imhist(I)
but the histogram is.. empty.
any idea why? this is the image i'm trying to show the histagram of.
thank you! please help.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 7 Mai 2020
Modifié(e) : Ameer Hamza le 7 Mai 2020
Your image is binary. It only has white and black pixels. Therefore it only has peaks at 0 and 255. Following example show, it has nothing to do it with png file.
im = imread('pears.png');
imhist(im)
  1 commentaire
Lulu Firdaus
Lulu Firdaus le 8 Mai 2020
I see. thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Image Filtering and Enhancement dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by