智能车制作
标题:
请一起分析一下图像滤波程序!
[打印本页]
作者:
林牛牛
时间:
2012-4-16 12:09
标题:
请一起分析一下图像滤波程序!
void LP_image() {
unsigned char *a_point,*b_point,*c_point;
unsigned char a,b,c,d,i,j;
for(i=0;i<ROW;i++) {
for(j=1;j<COLUMN;j++){
a_point=&Buffer[i][j-1];
b_point=&Buffer[i][j];
c_point=&Buffer[i][j+1];
a=*a_point;
b=*b_point;
c=*c_point;
if(a>=b) {
d=b;b=a;a=d;
}
if(a>=c){
d=c;c=a;a=d;
}
if(b>=c){
d=c;c=b;b=d;
}
*(b_point)=b;
}
}
}
void Image_Filte() {
unsigned char *a_point,*b_point,*c_point;
unsigned char a,b,c,d,i;
for(i=1;i<COLUMN-1;i++){
a_point=&image_center[i-1];
b_point=&image_center[i];
c_point=&image_center[i+1];
a=*a_point;
b=*b_point;
c=*c_point;
if(a>=b) {
d=b;b=a;a=d;
}
if(a>=c){
d=c;c=a;a=d;
}
if(b>=c){
d=c;c=b;b=d;
}
*(b_point)=b;
}
}
void count_centerline() {
unsigned char a=0,b=0,i,j;
for(i=ROW-2;i>0;i--)
{
for(j=60;j>0;j--)
{
if(Buffer[i][j]<THRESHOLD){
a=j;
break;
}
}
for(j=60;j<120;j++)
{
if(Buffer[i][j]<THRESHOLD){
b=j;
break;
}
}
if(i==ROW-10)
{
if(a==0) {
zuo_danxian=0;
} else zuo_danxian=1;
if(b==0) {
you_danxian=0;
} else you_danxian=1;
}
image_center[i+1]=(a+b)/2;
a=b=0;
}
// Image_Filte();
}
复制代码
欢迎光临 智能车制作 (http://dns.znczz.com/)
Powered by Discuz! X3.2