Difference between hist and imhist

13 次查看(过去 30 天)
Hi,
I have a fundamental question about the hist and imhist and an explanation will be great as I am a bit lost.
I am running this script:
I = imread('pout.tif');
figure;
x=imhist(I)
imhist(I)
figure(2);
hist(x)
and when I compare the two histograms they do not look alike, why?
How can I save the imhist data so that the hist will show the same plot?
Thanks

采纳的回答

Image Analyst
Image Analyst 2014-8-9
For a gray scale image imhist() will give 256 bins. hist() only gives 10 by default. But you did not use hist() to take the histogram of the image - the badly-named "I". You used it to take a histogram of the histogram counts, x - a pretty weird/strange thing to do.
  5 个评论
Image Analyst
Image Analyst 2016-7-8
Yes. It does not care what format was used to store the image on disk, it just looks at an array of numbers, which is what you get when you read a disk file into MATLAB.
Nagabhushan SN
Nagabhushan SN 2018-8-27
Hi @ImageAnalyst, you've mentioned that "IMPORTANT WARNING: counts(1) is not for gray level 0!!!" So do you mean that hist doesn't give histogram in order of intensity values? So, histogram plots by imhist(grayImage) and hist(double(grayImage(:)), 256) will be different?

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by