Image with uniform histogram

I have a grey scale image and I want to change the histogram of the image to uniform histogram. How should I do it?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Mayo de 2012

0 votos

6 comentarios

Juil
Juil el 30 de Mayo de 2012
will histeq function also make the histogram uniform?
Walter Roberson
Walter Roberson el 30 de Mayo de 2012
http://www.mathworks.com/help/toolbox/images/ref/histeq.html
histeq enhances the contrast of images by transforming the values in an intensity image, or the values in the colormap of an indexed image, so that the histogram of the output image approximately matches a specified histogram.
Juil
Juil el 30 de Mayo de 2012
the specified histogram I want is the uniform histogram. Will using histeq(image) output the uniform histogram?
Walter Roberson
Walter Roberson el 30 de Mayo de 2012
It will do what it can. Depending on the distribution of pixel values, it may not be possible to achieve equal distribution (at least not without randomly reassigning points.) For example there just isn't much that histogram equalization can do to equalize an image that is completely constant.
Walter Roberson
Walter Roberson el 30 de Mayo de 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 el 30 de Mayo de 2012
Many thanks :)

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 31 de Mayo de 2012

0 votos

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.

Preguntada:

el 30 de Mayo de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by