飞思卡尔智能车摄像头组freescale程序代码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
extern int left,w,top,h;
extern HDC m_hdc;
CBrush brush3(RGB(0,255,0));
CBrush brush4(RGB(255,0,0));
CBrush brush5(RGB(255,255,0));
#else
#include
#include "math.h"
// #include "LQfun.h"
#endif
#ifdef ccd
#define MAX_VIDEO_LINE 39
#define MAX_VIDEO_POINT 187
#else
//#define MAX_VIDEO_LINE 26
// #define MAX_VIDEO_POINT 301
#define MAX_VIDEO_LINE 78
#define MAX_VIDEO_POINT 57
#endif
extern unsigned char g_VideoImageDate[MAX_VIDEO_LINE][MAX_VIDEO_POINT];
#define INT8U unsigned char
#define INT8S signed char
#define INT16U unsigned int
#define INT16S int
#define INT32S int
#define NO_DATA_180 254
//#define INT32U unsigned int
unsigned char LIMIT=((MAX_VIDEO_POINT)/2);
unsigned char MIDDLE[MAX_VIDEO_LINE];
#define MAX_BLACK_NUM 7
INT8S n;
INT8U limit_cur;
INT8U BackLineValidFlag;
INT8U l_BlackStartDot;
INT8U k;
INT8U k2;
INT8U NextFlag;
INT16S g_SearchStart;
INT16S g_SearchEnd;
INT8U g_SearchDirection;
INT16S g_BlackMiddle[2];
INT8U g_BottomMiddle=MAX_VIDEO_POINT/2;
INT8U g_BlackPoint[2][MAX_BLACK_NUM];
INT8U g_BlackPoint_qipao[2][MAX_BLACK_NUM];
INT8U cnt;
INT8U cnt_large[MAX_VIDEO_LINE];
INT8U cnt_qipao;
INT8U g_BottomValidLine;
extern INT8U g_width[MAX_VIDEO_LINE];
extern INT8U g_BlackPositionCenter[MAX_VIDEO_LINE];
//INT16U g_center;
INT8U g_ValidLine;
INT16U g_BlackLineTotal;
INT8S g_error;
INT8S ValidLineError;
INT8S g_WidthError;
INT8S g_MinWidth;
INT8S g_MaxWidth;
extern INT8U g_IfCross;
unsigned char haveleft,haveright;
unsigned char left_n,right_n,left_or_right,left_center_x,right_center_x; INT8U cur_center;
//float g_DirectionControl;
//float g_DirectionControl_y;
//INT32S g_DirectionControlLine;
void init_pic_all()
{
INT8U i;
for(i = 0; i < MAX_VIDEO_LINE; i++) //78
{
//MIDDLE[MAX_VIDEO_LINE-1-i]=50+(90-50)*i/(MAX_VIDEO_LINE-1);
MIDDLE[MAX_VIDEO_LINE-1-i]=30+(50-30)*i/(MAX_VIDEO_LINE-1);
//150+powf(i/MAX_VIDEO_LINE,3.)/powf(1.,3.)*40;
//
MIDDLE[MAX_VIDEO_LINE-1-i]=90+(100-90)*i/(MAX_VIDEO_LINE-1);//150+powf(i/MA X_VIDEO_LINE,3.)/powf(1.,3.)*40;
}
}
void init_process(void)
{
//return;
INT8U i = 0;
for(i = 0; i < MAX_VIDEO_LINE; i ++) //39
{
g_BlackPositionCenter[i] = NO_DATA_180;
g_width[i] = 0;
cnt_large[i]=0;
}
NextFlag=0;
g_IfCross=0;
cnt_qipao=0;
haveright=0;
haveleft=0;
g_SearchStart = g_BottomMiddle - LIMIT;
g_SearchEnd = g_BottomMiddle + LIMIT;