智能车制作

标题: 蓝宙 黑线提取算法 [打印本页]

作者: 1013956044    时间: 2015-12-6 15:53
标题: 蓝宙 黑线提取算法
谁看过可以帮帮忙解释一下? 大概说下就好
/*************************************************************************
*                           蓝宙电子工作室
*
*  函数名称:AccommodFondLine
*  功能说明:求数组的均值程序
*  参数说明:
*  函数返回:无
*  修改时间:2012-11-20
*  备    注:自己适应算黑线位置算法
*************************************************************************/
#define LINEBREADTH    10    //xian kuan??
#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 ;

  }

}


作者: Sτrīvé___    时间: 2015-12-6 15:53
:):):):):)
作者: 1013956044    时间: 2015-12-6 15:53
说下怎么用也行  主要是函数的几个参数
作者: 1013956044    时间: 2015-12-6 18:30
Sτrīvé___ 发表于 2015-12-6 16:48

兄弟  可否交流下

作者: wxyriddler    时间: 2015-12-6 21:03
光电拿个拉普拉斯算子卷积一下取高频就可以了,多简单的事
作者: Sτrīvé___    时间: 2015-12-6 21:12
1013956044 发表于 2015-12-6 18:30
兄弟  可否交流下

这资料也是别人散的,我看对你可能有用就给你了!我没用它们的采!!自己多看看吧!!!

作者: 1013956044    时间: 2015-12-6 21:35
wxyriddler 发表于 2015-12-6 21:03
光电拿个拉普拉斯算子卷积一下取高频就可以了,多简单的事

兄弟 可否细述

作者: 1013956044    时间: 2015-12-6 21:37
Sτrīvé___ 发表于 2015-12-6 21:12
这资料也是别人散的,我看对你可能有用就给你了!我没用它们的采!!自己多看看吧!!!

好谢谢   你们现在图像采集回来了?还是开始跑了?

作者: wxyriddler    时间: 2015-12-7 00:13
本帖最后由 wxyriddler 于 2015-12-7 00:15 编辑
1013956044 发表于 2015-12-6 21:35
兄弟 可否细述

用-1,0,1或者1,0,-1做模板把数组卷积一遍,做个绝对值,设个阈值,就知道边缘在哪了啊

作者: Sτrīvé___    时间: 2015-12-7 10:47
1013956044 发表于 2015-12-6 21:37
好谢谢   你们现在图像采集回来了?还是开始跑了?

跑了!!

作者: 喆3喆    时间: 2015-12-7 22:15
wxyriddler 发表于 2015-12-7 00:13
用-1,0,1或者1,0,-1做模板把数组卷积一遍,做个绝对值,设个阈值,就知道边缘在哪了啊

兄弟是图像处理专业人士啊

作者: wxyriddler    时间: 2015-12-7 23:11
喆3喆 发表于 2015-12-7 22:15
兄弟是图像处理专业人士啊

不是……

作者: 永远的记忆    时间: 2016-2-27 19:22
程序中的s8,u8分别代表什么?
作者: 不贰    时间: 2016-8-5 18:08
Sτrīvé___ 发表于 2015-12-6 15:53

学习学习





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