智能车制作

标题: 求线性CCD中线提取参考例程 [打印本页]

作者: yangjie1995    时间: 2014-3-9 19:43
标题: 求线性CCD中线提取参考例程

望各位不吝赐教,给个程序参考一下,实在无从下手。
作者: stxhb    时间: 2014-3-10 23:54
由中向两边提取,或者由上次中点向两边提取,,如果左没上升沿,右没下降沿,返回提取左下降沿,右上升沿,然后判断偏差,,不要想有现成的程序,,可能技术报告上有
作者: 无线电——    时间: 2014-3-14 16:55
for(i=start_lie; i>=10; i--)

{

////////////////////////////////////////找左邊界點

for(j=pre_left_point-3;j<=pre_left_point+10;j++)

{

if((image_data[i][j]|image_data[i][j+1]|image_data[i][j+2]|image_data[i][j+3]==1)&&(image_data[i][j-1]&image_data[i][j-2]&image_data[i][j-3]&image_data[i][j-4]==0))

{

Left_point=j;

pre_left_point=j;

border_line[i][left_border]=j;

}

}
作者: yangjie1995    时间: 2014-3-20 12:39
stxhb 发表于 2014-3-10 23:54
由中向两边提取,或者由上次中点向两边提取,,如果左没上升沿,右没下降沿,返回提取左下降沿,右上升沿, ...

请问一下从上次中线向两边搜寻左右黑线,偏移量是用现在求出的中线与上次中线的差值来确定吗?而且我车子跑起来在比较急的弯道过程中会出现丢线问题,能说一下怎样解决吗?

作者: yangjie1995    时间: 2014-3-20 12:39
stxhb 发表于 2014-3-10 23:54
由中向两边提取,或者由上次中点向两边提取,,如果左没上升沿,右没下降沿,返回提取左下降沿,右上升沿, ...

请问一下从上次中线向两边搜寻左右黑线,偏移量是用现在求出的中线与上次中线的差值来确定吗?而且我车子跑起来在比较急的弯道过程中会出现丢线问题,能说一下怎样解决吗?

作者: stxhb    时间: 2014-3-20 19:58
yangjie1995 发表于 2014-3-20 12:39
请问一下从上次中线向两边搜寻左右黑线,偏移量是用现在求出的中线与上次中线的差值来确定吗?而且我车子 ...

我是用的与64的差值,我也丢线,现在正在换算法
作者: 隐逸流光    时间: 2014-3-20 20:14
#define LINEBREADTH    10
#define LINECONCAT     8
void AccommodFondLine(s8 *PixelAryy ,u8 PixelCount , s16 *LastLeftPixelStation,s16 *LastRingtPixelStation,u8 FAVAULE)
{
  static u8 NOLeftCount,NORingtCout ;
  s16 temp0B ,temp1B,temp2B,temp3B;
  u8 *LineStation ,LineCount ,*LineLeftStation,*LineRingtStation;
  s16 LeftMIN,LeftMAX,RingtMIN,RingtMAX;
  LineCount = 0 ;
  for(temp0B = 0 ; temp0B < PixelCount ; temp0B ++)
  {
    temp1B = temp0B ;
    temp2B = 0 ;
    /***********
    查找左边凹槽
    ***********/
    while(temp2B <= LINEBREADTH)
     {
      temp1B -- ;
      if(temp1B < 0)
        break ;
      if( PixelAryy[temp1B] -  PixelAryy[temp0B] > FAVAULE )
      { temp2B ++ ;}
      else if(temp2B)
      { break ; }

    }

    /***********
    查找右边凹槽
    ***********/
    temp1B = temp0B ;
    temp3B = 0 ;
    while(temp3B <= LINEBREADTH)
    {
      temp1B ++ ;
      if(temp1B > PixelCount)
      { break ; }
      if( PixelAryy[temp1B] -  PixelAryy[temp0B] > FAVAULE )
      { temp3B ++ ;}
      else if(temp3B)
      { break ; }
    }
    /***********
    记录黑线位置
    ***********/   
    if(temp2B >= LINEBREADTH ){
      *LineStation = temp0B ;
      LineCount ++ ;
    }else if(temp3B >= LINEBREADTH ){
      *LineStation = temp0B ;
      LineCount ++ ;
    }


  }
  /**********
  根据连续性查找左右黑线位置
  **********/
  if(LineCount)
  {
    temp2B = PixelCount >> 1 ;
    temp1B = NOLeftCount << 1;
    temp1B += LINECONCAT;
    LeftMIN = *LastLeftPixelStation - temp1B ;
    LeftMAX = *LastRingtPixelStation + temp1B ;
    if(LeftMIN < 0)
      LeftMIN = 0 ;

    if(LeftMAX > (temp2B + 1))
      LeftMAX  = temp2B + 1 ;

    RingtMIN = *LastRingtPixelStation - temp1B ;
    RingtMAX = *LastRingtPixelStation + temp1B ;
    if(RingtMAX > PixelCount)
       RingtMAX = PixelCount ;
    if(RingtMIN < (temp2B - 1)){
       RingtMIN = temp2B - 1 ;
    }
    temp2B = 0 ;
    temp3B = 0 ;
   for(temp1B = 0 ;temp1B < LineCount ;temp1B ++ )
   {
     if( (LeftMIN < LineStation[temp1B])&&(LineStation[temp1B]<LeftMAX))
     {
       LineLeftStation[temp2B] = LineStation[temp1B] ;
       temp2B ++ ;
     }else if( (RingtMIN < LineStation[temp1B])&&(LineStation[temp1B]<RingtMAX))
     {
       LineRingtStation[temp3B] = LineStation[temp1B] ;
       temp3B ++ ;
     }

   }

  }else
  {
    NOLeftCount ++ ;
    NORingtCout ++ ;
  }

  if(temp2B)
  {
    NOLeftCount = 0 ;

}
}

作者: 烽魔渣中渣    时间: 2014-3-22 20:57
无线电—— 发表于 2014-3-14 16:55
for(i=start_lie; i>=10; i--)

{

表示看不太懂!能否解释一下start_lie,pre_left_point,image_data,Left_point=j,border_line是表示什么呢?谢谢

作者: 烽魔渣中渣    时间: 2014-3-22 21:03
隐逸流光 发表于 2014-3-20 20:14
#define LINEBREADTH    10
#define LINECONCAT     8
void AccommodFondLine(s8 *PixelAryy ,u8 PixelC ...

呵呵!表示看不太懂,是否可以解释一下变量的意思呢!谢谢

作者: xxl123    时间: 2015-1-12 20:18
隐逸流光 发表于 2014-3-20 20:14
#define LINEBREADTH    10
#define LINECONCAT     8
void AccommodFondLine(s8 *PixelAryy ,u8 PixelC ...

能否解释一下的意思*PixelAryy

作者: 申继鹏    时间: 2015-3-28 08:41
无线电—— 发表于 2014-3-14 16:55
for(i=start_lie; i>=10; i--)

{

楼主能否简单解释一下此程序的思想

作者: 黎明的海洋    时间: 2015-3-28 11:52
隐逸流光 发表于 2014-3-20 20:14
#define LINEBREADTH    10
#define LINECONCAT     8
void AccommodFondLine(s8 *PixelAryy ,u8 PixelC ...

你这复制的蓝宙的算法

作者: 黎明的海洋    时间: 2015-3-28 11:55
无线电—— 发表于 2014-3-14 16:55
for(i=start_lie; i>=10; i--)

{

你这是二维数组,CCD没必要这么麻烦吧,一位数组就行了啊





欢迎光临 智能车制作 (http://dns.znczz.com/) Powered by Discuz! X3.2