Initial commit: TC264 smart car project with IPS200 menu system
- IPS200 display menu with real-time status and parameter settings - Camera image processing and line tracking - IMU attitude solution and PID control - WiFi SPI oscilloscope data transmission
This commit is contained in:
commit
843447835d
660 files changed
+443632
No files matched your search
@@ -0,0 +1,57 @@
|
||||
#ifndef _USER_LINE_PROCESS_H_
|
||||
#define _USER_LINE_PROCESS_H_
|
||||
|
||||
#include "zf_common_typedef.h"
|
||||
#include "zf_device_mt9v03x_double.h"
|
||||
|
||||
/*============================================================
|
||||
* 常量配置
|
||||
*============================================================*/
|
||||
#define MAX_EDGE_PTS 240 /* 最大边线点数 (图像高度) */
|
||||
|
||||
/*============================================================
|
||||
* 全局输出变量
|
||||
*============================================================*/
|
||||
extern float center_line[MAX_EDGE_PTS][2]; /* 赛道中线 (图像坐标) */
|
||||
extern uint16 center_line_num; /* 中线点数 */
|
||||
extern float left_edge[MAX_EDGE_PTS][2]; /* 左边线 (重采样后) */
|
||||
extern float right_edge[MAX_EDGE_PTS][2]; /* 右边线 (重采样后) */
|
||||
extern uint16 left_edge_num, right_edge_num; /* 边线点数 */
|
||||
extern float inflection_point[2]; /* 左拐点坐标 (图像) */
|
||||
extern uint8 inflection_found; /* 左拐点是否有效 */
|
||||
extern float inflection_point_r[2]; /* 右拐点坐标 (图像) */
|
||||
extern uint8 inflection_found_r; /* 右拐点是否有效 */
|
||||
|
||||
/*============================================================
|
||||
* 赛道边界检测 (迷宫法)
|
||||
*
|
||||
* 从 (start_x, start_y) 开始, 用左右手定则沿白线边缘向上追踪.
|
||||
* 内置底行全宽搜索兜底: 当中心点无赛道时自动扫描全行.
|
||||
*============================================================*/
|
||||
void find_circuit_edges(uint8 *binary, uint16 w, uint16 h,
|
||||
int16 start_x, int16 start_y,
|
||||
int16 left_pts[][2], uint16 *left_num,
|
||||
int16 right_pts[][2], uint16 *right_num);
|
||||
|
||||
/*============================================================
|
||||
* 中线计算 (插值补齐缺失边, 产生平滑稠密中线)
|
||||
*
|
||||
* 原始迷宫法左右追踪点 y 坐标不对齐, 同行配对极稀疏.
|
||||
* 本函数先对缺失边线做线性插值, 再对中线做空间平滑和鲁棒拟合.
|
||||
*============================================================*/
|
||||
void compute_center_line_interp(int16 left[][2], uint16 left_num,
|
||||
int16 right[][2], uint16 right_num,
|
||||
float center[][2], uint16 *center_num);
|
||||
|
||||
/*============================================================
|
||||
* 一帧图像处理主入口
|
||||
*
|
||||
* 输入: binary — 已二值化的图像 (140x80, 0x00=黑/背景, 0xFF=白/赛道)
|
||||
* 输出: center_line / left_edge / right_edge 全局变量
|
||||
*============================================================*/
|
||||
void line_process_run(uint8 *binary);
|
||||
|
||||
/* 中线加权偏差 (仅计入 y>=min_row 的下半部分, 底部权重更大) */
|
||||
float line_compute_weighted_deviation(uint16 image_center_x, uint16 min_row);
|
||||
|
||||
#endif /* _USER_LINE_PROCESS_H_ */
|
||||
Reference in new issue
Block a user