Problem with imhist function ?

3 views (last 30 days)
Jenny
Jenny on 16 Dec 2012
Commented: Zahra Saman on 12 Apr 2018
I have a GUI made with GUIDE and I want to upload an image and then show a histogram to see the distribution of intensities. I have a pushbutton "upload", I store the image (I) and then I make it shown through imshow(I). Until now everything is ok. After that, I have a pushbutton which takes me to another GUI named "histogram". I use rgb2gray at the first GUI, so my image is ready to be shown in a histogram. I pass the variables needed (setappdata,getappdata) to the second GUI and I write imhist(Igray) . I can only see an empty histogram with the gray scale down on it. No histogram has been shown. What is wrong?

Answers (1)

Image Analyst
Image Analyst on 16 Dec 2012
When you do
[pixelCounts grayLevels] = imhist(Igray);
and then examine pixelCounts in the debugger, what are its values? Are all bins zero? Are they all zero except for 1 bin? What does "whos Igray" report back to you?

Community Treasure Hunt

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

Start Hunting!