Add light bar detector and detect_test

- traditional CV pipeline referencing jlu_vision_26:
  HSV mask -> contour LightBar -> PCA corner refine -> pairing gates
- big/small armor classification (bar distance / bar length ratio)
- detect_test with synthetic selftest, 6/6 passed
- measured armor size 131.56x55mm, solver NaN guard + ITERATIVE fallback
This commit is contained in:
2026-09-17 00:34:24 +08:00
parent 19ac43da6f
commit f3b06d6abe
10 changed files with 1063 additions and 77 deletions
+9 -7
View File
@@ -37,10 +37,12 @@ struct ArmorSize {
double width_mm;
double height_mm;
/** 大装甲板:英雄(一号)230mm 间距 */
static ArmorSize big() { return ArmorSize{230.0, 56.0}; }
/** 小装甲板:2/3/4/5 号、哨兵 135mm 间距 */
static ArmorSize small() { return ArmorSize{135.0, 56.0}; }
/** 大装甲板:英雄(一号)。W=230mm 为官方灯条中心距名义值,
* 等实测大板后再校正;L=55mm 与小装甲灯条同长 */
static ArmorSize big() { return ArmorSize{230.0, 55.0}; }
/** 小装甲板:2/3/4/5 号、哨兵。2026-09-16 实测 3 号板:
* W=131.56mm(官方规格灯条中心距 131.5mm,实测一致),L=55.0mm */
static ArmorSize small() { return ArmorSize{131.56, 55.0}; }
};
/** 位姿解算结果(相机坐标系,单位 mm) */
@@ -72,9 +74,9 @@ public:
/**
* 四个角点 → 装甲板位姿
* 内部流程:solvePnPGeneric(IPPE) 取回全部候选解 →
* 依次筛掉「z<=0(相机后方)」「重投影超差」→ 取重投影最小者。
* 注:角点在解算前先做去畸变(IPPE+畸变+板内旋转组合有数值坑)。
* 内部流程:solvePnPGeneric(IPPE) 取回全部候选解 → 筛掉
* 「非有限值」「z<=0(相机后方)」「重投影超差」→ 取重投影最小者;
* 若 IPPE 数值退化(全被筛掉),自动退回 SOLVEPNP_ITERATIVE。
* @param corners 图像坐标(原图,含畸变),顺序:左下、左上、右上、右下
* @param size 装甲板物理尺寸
* @return 成功返回位姿;全部候选被筛掉时返回 std::nullopt