Image with uniform histogram

5 views (last 30 days)
Juil
Juil on 30 May 2012
I have a grey scale image and I want to change the histogram of the image to uniform histogram. How should I do it?

Accepted Answer

Walter Roberson
Walter Roberson on 30 May 2012
  6 Comments
Walter Roberson
Walter Roberson on 30 May 2012
Oh wait, I should have said "NO". histeq() applied to an image will output the adjusted image, not the histogram of the adjusted image. You would still need something like imhist() applied to the histeq() adjusted image in order to get the new histogram.
Juil
Juil on 30 May 2012
Many thanks :)

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 31 May 2012
Histogram equalization WILL NOT give you a flat histogram. If someone told you that, then they were wrong. It would only work for the case of infinite number of pixels and infinite number of gray levels, essentially a continuum in both space and intensity. If you want a flat histogram for finite-sized, intensity-quantized actual real world digital images, you'll need to use my histogram shaping program which WILL give you a flat histogram, or any other shape you can possibly think of. http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 The screenshot shows the image going to the shape of a girl's silhouette but like the text says, it also can give you a flat histogram - it asks you which you want when it starts up. The histogram will be truly exactly flat, at least to the extent that it can be. The only situation when it won't is when your image doesn't have an integer multiple of 256 pixels because it can't be perfectly flat in that case (think about it). But it will be as flat as mathematically possible. It's an clever and interesting algorithm - it uses noise and sorting to enforce perfect flatness and avoid contours.

Community Treasure Hunt

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

Start Hunting!