删除斑马线存图临时功能; 斑马线阈值0.87→0.82; 搜线加CLAHE反光压制+扩大形态学核

This commit is contained in:
spdis
2026-06-29 17:15:36 +08:00
parent 017a827b18
commit 4a38259d25
2 changed files with 14 additions and 2 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ static constexpr int calc_scale = 2;
// g_boxes: 检测结果缓冲区 (最多 16 个框)
// g_box_count: 当前帧有效检测框数
// ═══════════════════════════════════════════════════════════
static float g_thresh[4] = {0.80f, 0.75f, 0.80f, 0.87f};
static float g_thresh[4] = {0.80f, 0.75f, 0.80f, 0.82f};
static DetectBoxV10 g_boxes[16];
static int g_box_count = 0;
+13 -1
View File
@@ -104,7 +104,7 @@ cv::Mat image_binerize(cv::Mat &frame)
// ============================================================
cv::Mat find_road(cv::Mat &frame)
{
static cv::Mat kernel = cv::getStructuringElement(cv::MORPH_CROSS, cv::Size(2, 2));
static cv::Mat kernel = cv::getStructuringElement(cv::MORPH_CROSS, cv::Size(3, 3));
cv::morphologyEx(binarizedFrame, morphologyExFrame, cv::MORPH_OPEN, kernel);
static cv::Mat mask;
@@ -161,6 +161,18 @@ void image_main()
cv::resize(raw_frame, resizedFrame,
cv::Size(line_tracking_width, line_tracking_height));
// ── 1.5 CLAHE 亮度归一化 → 压制反光 ────────────
// 先转 LAB, 对 L 通道做局部直方图均衡, 再转回 BGR
// 作用: 亮斑被压暗, 暗区被提亮, 赛道颜色更均匀
static cv::Mat labFrame;
static std::vector<cv::Mat> labCh(3);
static cv::Ptr<cv::CLAHE> clahe = cv::createCLAHE(2.0, cv::Size(8, 8));
cv::cvtColor(resizedFrame, labFrame, cv::COLOR_BGR2Lab);
cv::split(labFrame, labCh);
clahe->apply(labCh[0], labCh[0]);
cv::merge(labCh, labFrame);
cv::cvtColor(labFrame, resizedFrame, cv::COLOR_Lab2BGR);
// ── 2. HSV 双通道 Otsu 二值化 ─────────────────────
// 赛道区域 = 白色(255),背景/边界 = 黑色(0)
binarizedFrame = image_binerize(resizedFrame);