#ifndef _CAMERA_H
#define _CAMERA_H

#include "zf_common_headfile.h"

#define LCDH 60                              //用于图像处理的图像高度（行）
#define LCDW 80                              //用于图像处理的图像宽度（列）
#define ImageSensorMid 39                    //图像的屏幕中点
#define LimitL(L) (L = ((L < 1) ? 1 : L))    //限幅限幅
#define LimitH(H) (H = ((H > 78) ? 78 : H))  //限幅限幅
#define Garage_Number 2                      //车库次数
extern uint8 Mid_line[60];                   //最开始写的Get_SideLine搜边线函数里面用来存放中线的数组
extern uint8 Left_line[60];                  //最开始写的Get_SideLine搜边线函数里面用来存放左边线的数组
extern uint8 Right_line[60];                 //最开始写的Get_SideLine搜边线函数里面用来存放右边线的数组
extern int Out_Garage_Help_Flag;   // 1 :左边出车库   2 :右边出车库
extern int Out_Garage_Help_enable;   // 1 :出车库   2 :已出车库
extern uint8 Image_Scan_Flag;//后车打开元素识别标志
extern int32 Image_Scan_Length;
extern int32 RoadBlock_length;
extern uint8 Pixle[LCDH][LCDW];
extern uint8 Image_Use[LCDH][LCDW];
extern uint16 threshold1,threshold2,threshold3,yuzhi;
extern uint16 RoadBlock_Thruough_Flag1,RoadBlock_Thruough_Flag2,Ramp_cnacel;
extern uint16 block_yuzhi1,block_yuzhi2,block_yuzhi3;
extern int32 Zebra_length;
extern int Black;
extern uint16 distance;
extern uint8 Image_iError_Flag;
/////////////////////////////////
extern int jianzhaopian_flag;
////////////////////////////////
//每一行的属性
typedef struct {
	//梯度扫线数据
  uint8 IsRightFind;      //右边有边标志
  uint8 IsLeftFind;       //左边有边标志
  int Wide;               //边界宽度	
  int LeftBorder;         //左边线 梯度扫线	
  int RightBorder;        //右边线
  int Center;              //中线
	
  int TopBorder;              //顶部边线
	//左右手法则扫线数据
  int LeftBoundary_First;  //左边界 保存第一次数据
  int RightBoundary_First; //右边界 保存第一次数据
  int LeftBoundary;		   //左边界 保存最后一次数据
  int RightBoundary;	   //右边界 保存最后一次数据
 

} ImageDealDatatypedef;

typedef struct {
  //图像信息
  int TowPoint;             //控制行，也就是我说的前瞻
  
  uint8 OFFLine;            //图像顶边
  uint8 WhiteLine;          //双边丢边数
	uint8 OFFLineBoundary;   //八领域截止行
	uint8 Miss_Left_lines;                      //左线丢失
  uint8 Miss_Right_lines;                     //右线丢失
	int Det_True;
	float MU_P;
	float MU_D;
	//左右手法则扫线数据
  uint8 WhiteLine_L;		//左边丢线数
  uint8 WhiteLine_R;		//右边丢线数
} ImageStatustypedef;

typedef struct {
  int point;
  uint8 type;
} JumpPointtypedef;

typedef struct {
    uint8 zafawfwagsg;
    uint8 Bend_Road;//                            /*0 :无               1 :右弯道     2 :左弯道*/
    uint8 image_element_rings;//                  /*0 :无圆环          1 :左圆环       2 :右圆环*/
    uint8 ring_big_small;                       /*0:无                    2 :大圆环      1 :小圆环*/
    uint8 zafawfgwa;
    uint8 image_element_rings_flag;//             /*圆环进程*/
    uint8 straight_long;//                        /*长直道标志位*/
    uint8 straight_xie;//
    uint8 Garage_Location;                      /*0 :无车库          1 :左车库       2 :右车库*/
    uint8 Zebra_Flag;                           /*0 :无斑马线       1 :斑马线*/
    uint8 Ramp;                                  /*0 :无坡道        1：坡道*/
    uint8 RoadBlock_Flag;                        /*0 :无路障        1 :左过路障     2 :右过路障*/
    uint8 Out_Road;                               /*0 :无断路      1 :断路*/
} ImageFlagtypedef;

extern ImageDealDatatypedef ImageDeal[60];
extern ImageStatustypedef ImageStatus; 
extern ImageFlagtypedef ImageFlag;

extern int cross_flag;
extern int huandao_flag;
extern int huandao_jingcheng_flag;

extern int continue_raoquan_flag;

extern uint32 break_road(uint8 line_start);
void Image_CompressInit(void);
void Image_Process(void);
void Get_SideLine(void);
void Get_BinaryImage(void);
extern uint8 Garage_Location_Flag;
void Get_Border_And_SideType(uint8* p,uint8 type,int L,int H,JumpPointtypedef* Q) ;
void Get_BaseLine(void);
void Get_AllLine(void);
void Get_ExtensionLine(void);
void Image_iError_Scan();
void After_Start_Go();
void Flag_init(void);

void Element_Judgment_Zebra(void);
void Scan_Element(void);
void cross_judgment();

//extern uint8 get_Threshold(uint8* image[][LCDW],uint16 col, uint16 row);
#endif



