for(u=0;u<256;u++) //clear HIST array
{
HIST[u]=0;
}
for(x=0;x<R;x++)
{
for(y=0;y<C;y++)
{
v=image[x][y];
if(v>255) //boundary values 0 to 255
{
image[x][y]=255;
}
if(v<0)
{
image[x][y]=0;
}
HIST[v]=HIST[v]+1; //extract histogram
}
}
for(x=0;x<R;x++)
{
for(y=0;y<C;y++)
{
val=image[x][y];
for(i=0;i<val;i++)
{
hist_n=hist_n+HIST[i];
}
image[x][y]=(255*hist_n)/(R*C);
}
}
that again is not working with the method in the paper..what window size would be very apt for this operation??Noise is a problem in your case! Try to remove (exclude) the dark corners...
/* histogram */
for(u=0;u<256;u++) //clear HIST array
{
HIST[u]=0;
}
for(x=0;x<R;x++)
{
for(y=0;y<C;y++)
{
v=image[x][y];
if(v>255) //boundary values 0 to 255
{
image[x][y]=255;
printf("255\n");
}
if(v<0)
{
image[x][y]=0;
printf("0\n");
}
HIST[v]=HIST[v]+1; //extract histogram
}
}
/*contrast strtetching*/
for(v=0;v<256;v++) //c
{
totpix=totpix+HIST[v];
if(totpix>9830) //9830 is 15% of image pixels
{
cmin=v;
goto corpse;
}
}
corpse:
totpix=0;
for(v=0;v<256;v++) //d
{
totpix=totpix+HIST[v];
if(totpix>55705) //85% of image pixels[256x256]
{
dmax=v;
goto carrion;
}
}
carrion:
for(x=0;x<R;x++)
{
for(y=0;y<C;y++)
{
if((dmax-cmin) == 0)
histo[x][y]=(image[x][y]-cmin)*((255-0)/(dmax-cmin))+0;
}
}
for(x=0;x<R;x++)
{
for(y=0;y<C;y++)
{
image[x][y]=histo[x][y];
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?