Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Histogram to image

Asked by M W on 23 Dec 2011

Hi, I'm a Matlab newbie and I desperately need your help. I need to enhance image by performing operations on its histogram. But how can I apply that changes to the image? It's easy to extract histogram form the image but how to transform histogram back into image after performing e.g. histogram smoothing?

0 Comments

M W

Products

No products are associated with this question.

2 Answers

Answer by Image Analyst on 24 Dec 2011

I suppose you could maybe use the intlut() function. But why don't you tell us what you want to do and we can tell you the best way to achieve it? You can upload your image to tinypic.com.

0 Comments

Image Analyst
Answer by M W on 24 Dec 2011

Thanks for the answer.

I need to implement a Generalized Histogram Equalization algorithm. The method is described in the following article (click to open/download a PDF file)

http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&ved=0CDYQFjAC&url=http%3A%2F%2Fciteseerx.ist.psu.edu%2Fviewdoc%2Fdownload%3Fdoi%3D10.1.1.158.5215%26rep%3Drep1%26type%3Dpdf&ei=J5f1TuLROsXu-gappN26Dw&usg=AFQjCNG5EmCpWxRh_j77kBjc7gEKxVHrJw&sig2=ueFOPNccU0lX2dI29DhnxQ

I'm stuck at the point where I have to remove the noise from histogram. I can do it e.g. with the medfilt1() method. It works fine for the histogram but what about the image? I need to change the image too. Is there any way to recreate the image based on the new histogram?

6 Comments

M W on 25 Dec 2011

Thanks again, you are really helping me!
Your histogram shaping program seems to be an amazing piece of code. I figured out that the TransformImage() function is the key for equalization. I'm now able to equalize histogram for any image. It really is flat and the image's contrast is improved.
However I have a hard time modifying it so that it works only for specified piece of histogram (e.g bins form 90 to 150) and the rest of the bins should be left as they are.
Another approach could be to pass a matrix with specified points and desired heights of the bins between that points) to the function and perform the equalization based on this matrix.
Can I ask for a little help?

Image Analyst on 25 Dec 2011

It may take you a while, as it would for me, but I think is something that you could handle.

M W on 25 Dec 2011

Yea, I think I can do it. You provided a really good commentary.
I've spent some time looking through this code and I see that the desiredPixelsInEachBin vector may be the key.

M W

Contact us