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

I want to know if we can implement histogram equalization without the histeq function?

Asked by Ali on 6 Dec 2011

I have a project and I have to implement histogram equalization without using the histeq function anybody have any idea ?

0 Comments

Ali

Products

No products are associated with this question.

3 Answers

Answer by Sean de Wolski on 6 Dec 2011

FEX:ImageAnalyst's:Demo

Probably worth a read

0 Comments

Sean de Wolski
Answer by Image Analyst on 6 Dec 2011

Check out my histogram shaping app:

http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862

It will give you a perfectly flat histogram, or any other shape you desire. Otherwise you can do the standard, dumb, imperfect method where you use cumsum() but that won't get you a flat histogram, just a stretched-out/redistributed one.

0 Comments

Image Analyst
Answer by Jurgen on 15 Nov 2012

4 bit grayscale example:

     grayLevels  = (0:15); 
        %Histogram of image, counts per level:
     grayHist    = [0 0 40 80 45 11 70 0 0 0 0 0 0 0 0 15]; 

Make new gray value table with formula:

EQfactor = grayLevels(end)/sum(grayHist);
grayEq   = round(EQfactor*cumsum(grayHist)); 

Finished, Use LUT for equalizing; apply like 'grayEq(im + 1)'

-

Extra info: Use LUT to find new histogram without image data

newGray = zeros(1,length(grayLevels)); % New histogram of image
% Bit messy now:
values  = grayHist(grayLevels+1);  
newGray(unique(grayEq(grayLevels+1)+1)) = [0 values(values>0)];
stem(newGray);figure;stem(grayHist)

0 Comments

Jurgen

Contact us