Link to home
Start Free TrialLog in
Avatar of killaz4life
killaz4life

asked on

Histogram equalization

Hi there,
I have been having alot of trouble trying to make the histogramn equalization work in c++ and this laplacian smoothing is not working at all with me.
My program only enhances gray scale currently so im not involved with any rgb being stored and I am sending to my functions the array image2D[row][col] that contains the pixel values.
Thankyou
Avatar of Infinity08
Infinity08
Flag of Belgium image

Can you tell us the exact problem you have, as well as the relevant code you have ?
Avatar of killaz4life
killaz4life

ASKER

void CImgProcess::histogramEqualisation()
{

    for(int r=0;r<ROW;r++)
            for(int c=0;c<COL;c++)
            {
                  double value=image2D[r][c]; value = value/255;
                  value=value*255/(ROW*COL);
                  image2D_Buffer[r][c]=(unsigned char)value;                  
            }


}
>>                value=value*255/(ROW*COL);
What do you intend to do here ?

In general value will end up to be 0 in most cases. I'm sure that's not what you want.
What should i do then?? Help me with the function, what I do wrong??
As i asked : what do you want do do ?
I want to do histogram equalization thas what I want to do! Ok I get rid of value=value/256;
I really hope u know what histogram equalization is.
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And here's a nice link explaining the process :

http://www.generation5.org/content/2004/histogramEqualization.asp


btw, I didn't test the code, so you'll have to do that before assuming it's 100% correct !!
I just tested the code you gave me, there some reason I only see blocks rather than image enhancement. Could it be possible the int is doing any effect?
What do you mean by "blocks" ?

The code I gave was not tested, and was written from my head ... so there could be errors present ... It was meant to give you an idea about the code rather than to use it as is.

In any wase, the big lines should be ok. You might want to check the intermediate outputs to see if the result is as expected.

Try it on an image you know should be enhanced by this process (eg. the ones on the site i referred to earlier).