问题分析
你的标定文件是有效的,但有两个关键问题:
问题 1:分辨率不匹配 
| 配置项 | 标定文件 | 启动命令 |
|---|---|---|
| image_width | 1280 | 544 |
| image_height | 1088 | 448 |
标定文件是基于 1280×1088 标定的,但你用 544×448 启动,导致内参缩放计算异常。
问题 2:MIPI 通道仍然错误
日志持续报错:
[ERROR] [StereoNetNode]: => top is not left image, please swap the mipi cables, or set the mipi_channel and mipi_channel2 parameters.
解决方案
步骤 1:使用正确的分辨率启动
必须使用标定文件对应的分辨率 1280×1088:
source /opt/tros/humble/setup.bash
ros2 launch hobot_stereonet stereonet_model_web_visual_v2.5_int16_544_448_96.launch.py \
mipi_camera_calibration_file_path:=/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml \
mipi_image_width:=1280 \
mipi_image_height:=1088 \
mipi_image_framerate:=10.0 \
mipi_gdc_enable:=True \
mipi_rotation:=0.0 \
mipi_cal_rotation:=0.0 \
mipi_channel:=0 \
mipi_channel2:=2 \
calib_method:=none
关键修改:
mipi_image_width:=1280(不是 544)mipi_image_height:=1088(不是 448)mipi_channel:=0和mipi_channel2:=2(交换试试)
步骤 2:如果通道还是报错,尝试 4 种组合
SC132GS 双目相机的 MIPI 通道组合可能是以下之一:
| 组合 | mipi_channel | mipi_channel2 |
|---|---|---|
| 组合 1 | 0 | 2 |
| 组合 2 | 2 | 0 |
| 组合 3 | 0 | 1 |
| 组合 4 | 1 | 0 |
逐个尝试,直到日志中不再出现 top is not left image 错误。
步骤 3:验证内参加载成功
启动后,确认日志中出现:
正确标志:
[WARN] [StereoNetNode]: => sub rectified [fx, fy, cx, cy, baseline(m), doffs] : [xxx, xxx, xxx, xxx, 0.079239, 0.000000]
(fx/fy 不为 0,baseline 约 0.079)
错误标志:
[camera_fx, camera_fy, camera_cx, camera_cy, baseline, doffs]: [0, 0, 0, 0, 0(m)0]
Target FOV 0.00° out of valid range
关于标定文件的说明
你的标定文件参数是正确的:
- 基线距离:7.92cm(T 矩阵第一个值 -0.079168)
- 焦距:fx≈657, fy≈656(1280×1088 分辨率下)
- 畸变系数:8 参数模型,已完整标定
但必须用 1280×1088 分辨率才能正确加载这些参数!
快速测试命令
# 测试组合 1:通道 0+2,分辨率 1280x1088
ros2 launch hobot_stereonet stereonet_model_web_visual_v2.5_int16_544_448_96.launch.py \
mipi_camera_calibration_file_path:=/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml \
mipi_image_width:=1280 \
mipi_image_height:=1088 \
mipi_channel:=0 \
mipi_channel2:=2 \
mipi_gdc_enable:=True
# 如果还报错,测试组合 2:通道 2+0
ros2 launch hobot_stereonet stereonet_model_web_visual_v2.5_int16_544_448_96.launch.py \
mipi_camera_calibration_file_path:=/opt/tros/humble/lib/mipi_cam/config/SC132gs_dual_calibration.yaml \
mipi_image_width:=1280 \
mipi_image_height:=1088 \
mipi_channel:=2 \
mipi_channel2:=0 \
mipi_gdc_enable:=True
参考帖子
- RDK-X5 双目深度算法精度差 - 深度精度调试
- 如何自行标定相机 - 标定流程
先解决分辨率和通道问题,再测试深度精度! 有进展请更新帖子。