![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291116/image.png)
histogram doesn't work for .png images?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Lulu Firdaus
il 7 Mag 2020
Commentato: Lulu Firdaus
il 8 Mag 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291114/image.jpeg)
any idea why? this is the image i'm trying to show the histagram of.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291115/image.png)
thank you! please help.
0 Commenti
Risposta accettata
Ameer Hamza
il 7 Mag 2020
Modificato: Ameer Hamza
il 7 Mag 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)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/291116/image.png)
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Histograms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!