Add pose_test tool and harden solvePose; expose camera controls

- pose_test: verify the geometry chain (4 corners -> distance/yaw/pitch)
  before any detector exists; modes: camera + mouse clicks, --image,
  --corners (headless), --selftest (synthetic round-trip, no camera needed)
- solvePose: undistort corners first, then solvePnPGeneric(IPPE) and pick
  the best candidate; reject solutions behind the camera (z<=0) or with
  reprojection error > 8px
  - fixes IPPE + distortion + in-plane rotation returning garbage
  - 4 coplanar points: cyclic/mirrored orderings give the same quad and
    the same pose (harmless); crossing orderings blow up reprojection
    and are rejected
- camera_set: implement setAeState/setExposureTime/setAnalogGain(+-Times)/
  setWbMode/setFrameSpeed; configs/camera_runtime.yaml drives them
- selftest passes all 6 synthetic cases; verified on 6 real photos
  (chessboard outer rect 180x120mm): distance 0.44-0.69m, reproj <2.5px
This commit is contained in:
2026-09-16 21:08:03 +08:00
parent c50be9a48d
commit 19ac43da6f
8 changed files with 724 additions and 30 deletions
+10
View File
@@ -29,6 +29,7 @@ target("27RM")
add_files("src/*.cpp")
remove_files("src/capture_calib.cpp")
remove_files("src/calibrate.cpp")
remove_files("src/pose_test.cpp")
-- 标定图采集工具
-- ./build/linux/x86_64/debug/capture_calib (MindVision 相机)
@@ -43,3 +44,12 @@ target("calibrate")
add_rules("rm_deps")
set_kind("binary")
add_files("src/calibrate.cpp")
-- 几何链路验证工具(4 角点 → PnP → 距离/yaw/pitch)
-- ./build/linux/x86_64/debug/pose_test (相机 + 鼠标点角)
-- ./build/linux/x86_64/debug/pose_test --selftest (合成自检,无需相机)
-- ./build/linux/x86_64/debug/pose_test --image x.jpg --corners x1,y1 x2,y2 x3,y3 x4,y4
target("pose_test")
add_rules("rm_deps")
set_kind("binary")
add_files("src/pose_test.cpp", "src/camera_calib.cpp", "src/camera_set.cpp")