void DibContrasteBase(CDib& dib)
{
int low,high;
int indexI, indexJ;
int w= dib.GetWidth();
int h= dib.GetHeight();
float histo[256];
DibHistogram(dib,histo);
double cBaseHisto[256]={0.0};
BYTE** ptr = dib.GetPtr();
/* Initializing the Base LUT to 0's*/
for(int i =0;i<255;i++)
{
cBaseHisto[i]=0;
}
high = 0;
for(int i =255;i>0;i--)
{
if(histo[i]>histo[high])
{
high =i;
}
}
low = high;
for (int i =0;i<255;i++)
{
if(histo[i]<histo[low] && histo[i] != 0)
{
low = i;
}
}
for(int i=0;i<255;i++)
{
cBaseHisto[i]=limit( (histo[i] - histo[low])/(histo[high] - histo[low]) )*255;
}
for(indexJ =0;indexJ<h;indexJ++)
{
for(indexI =0;indexI<w ;indexI++)
{
ptr[indexI][indexJ] = cBaseHisto[ptr[indexI][indexJ] ];
}
}
}