中级会员
- 积分
- 367
- 威望
- 201
- 贡献
- 90
- 兑换币
- 120
- 注册时间
- 2013-7-16
- 在线时间
- 38 小时
|
void yuzhi(void)
{
unsigned char i;
unsigned char max=0,min=0,sum=0,sum1=0,sum2=0,n=0,n1=0,n2=0,E[128],f1[128],f2[128],T=0,Eg1=0,Eg2=0;
min=*gPixel;
for(i=ccdleft;i<=ccdright;i++)
{
if(gPixel[i]>260||gPixel[i]<80)
continue;
if(gPixel[i]>max)
max=gPixel[i];
else if(gPixel[i]<min)
min=gPixel[i];
T=(unsigned char)((max+min)/2);
for(i=ccdleft;i<=ccdright;i++)
{
if(gPixel[i]<max&&gPixel[i]>min)
{
gPixel[i]=E[i];
sum+=E[i];
n++;
}
if(gPixel[i]<T)
{
gPixel[i]=f1[i];
sum+=f1[i];
n1++;
}
else if(gPixel[i]<T)
{
gPixel[i]=f2[i];
sum+=f2[i];
n2++;
}
}
}
Eg1=(sum+sum1)/(n+n1);
Eg2=(sum+sum2)/(n2+n2*n/n1);
threshold=(Eg1+Eg2)/2;
}
|
|