RDK X5 视频、扫描,建模,为什么显示满屏距离标识,没有物体识别呢?正常建模应该是怎么样的

问题总结与最终方案

感谢 Marcelo6151 的确认!现在问题已经非常明确了。


核心结论

问题 状态
mipi_cam 2.5.6 是否支持 EEPROM 外参读取? :cross_mark: 不支持
未来是否支持? :white_check_mark: 有计划开放
当前解决方案? 手动创建标定文件重新标定

当前可行的解决方案

方案 1:从 EEPROM 日志提取参数,手动创建标定文件(推荐)

# 1. 启动相机,捕获完整日志
source /opt/tros/humble/setup.bash
ros2 run mipi_cam mipi_cam_node \
  --ros-args \
  -p image_width:=1280 \
  -p image_height:=1088 \
  -p channel:=2 \
  -p channel2:=0 \
  -p gdc_enable:=true \
  -p device_mode:=dual 2>&1 | tee /tmp/mipi_full_log.txt

# 2. 提取标定参数
grep -A 50 "stetreo calibration" /tmp/mipi_full_log.txt

从日志中找到这些数据

Kl : [656.757522, 0, 636.399596; 0, 656.376693, 540.475675; 0, 0, 1]
Dl : [-0.329908, 0.136626, ...]
Kr : [659.095726, 0, 632.540331; ...]
Dr : [-0.336482, 0.146403, ...]
R_rl : [0.999995, -0.002907, ...]
t_rl : [-0.079168; 0.000271; 0.003330]

创建标定文件

cat > /home/sunrise/sc132gs_eeprom_calib.yaml << 'EOF'
%YAML:1.0
---
image_width: 1280
image_height: 1088
left_camera_matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [656.7575224009456, 0, 636.3995967335052, 0, 656.3766938297126, 540.4756754786636, 0, 0, 1]
left_distortion_coefficients: !!opencv-matrix
   rows: 1
   cols: 8
   dt: d
   data: [-0.32990876095880534, 0.13662699921032978, -0.00013531813117594095, -9.84710031787936e-05, -0.02937890519777009, 0.00014050652399494757, 4.560677311111928e-05, 4.667085000242849e-05]
right_camera_matrix: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [659.0957261498398, 0, 632.5403313828651, 0, 658.9494113212542, 539.3174440945205, 0, 0, 1]
right_distortion_coefficients: !!opencv-matrix
   rows: 1
   cols: 8
   dt: d
   data: [-0.33648211988088883, 0.14640319389383946, -9.945169177922777e-06, -0.0002291888331273915, -0.034067021404055015, -4.29001168046378e-05, -0.00023103725828151024, 0.00012545114191076973]
R: !!opencv-matrix
   rows: 3
   cols: 3
   dt: d
   data: [0.9999953142616191, -0.002907409016669017, 0.0009583462919259559, 0.0029068591885358154, 0.9999956099808883, 0.0005746204042934068, -0.0009600127413120272, -0.0005718319340480337, 0.999999375691693]
T: !!opencv-matrix
   rows: 3
   cols: 1
   dt: d
   data: [-0.079168011922606, 0.0002710668686210683, 0.00333092179027396]
EOF

使用新标定文件启动

ros2 launch hobot_stereonet stereonet_model_web_visual_v2.5_int16_544_448_96.launch.py \
  mipi_camera_calibration_file_path:=/home/sunrise/sc132gs_eeprom_calib.yaml \
  mipi_image_width:=1280 \
  mipi_image_height:=1088 \
  mipi_channel:=2 \
  mipi_channel2:=0 \
  calib_method:=none \
  mipi_gdc_enable:=True

方案 2:重新标定(如果 EEPROM 参数无效)

# 1. 准备棋盘格(11x8 角点,6cm 方格)
cd /opt/tros/humble/share/hobot_stereonet/config/

# 2. 采集 20+ 张图像
bash run_stereo.sh --calibration_mode True \
  --save_dir /home/sunrise/calib_images \
  --mipi_image_width 1280 \
  --mipi_image_height 1088 \
  --mipi_channel 2 \
  --mipi_channel2 0

# 3. 执行标定
bash run_stereo.sh --calibration_mode True \
  --chessboard_per_rows 11 \
  --chessboard_per_cols 8 \
  --chessboard_square_size 0.06 \
  --save_calib True \
  --calib_save_path /home/sunrise/new_sc132gs_calib.yaml

# 4. 使用新标定文件启动
ros2 launch hobot_stereonet stereonet_model_web_visual_v2.5_int16_544_448_96.launch.py \
  mipi_camera_calibration_file_path:=/home/sunrise/new_sc132gs_calib.yaml \
  mipi_image_width:=1280 \
  mipi_image_height:=1088 \
  mipi_channel:=2 \
  mipi_channel2:=0 \
  calib_method:=none

方案 3:等待官方版本更新

关注以下渠道获取支持 EEPROM 读取的新版本:


验证步骤

# 1. 启动后检查日志
ros2 launch ... 2>&1 | grep -E "fx|baseline|top is not"

# ✅ 成功标志
[WARN] [StereoNetNode]: => sub rectified [fx, fy, cx, cy, baseline(m), doffs] : [293.04, 283.91, 295.91, 222.58, 0.079239, 0.000000]
# 不再出现 "top is not left image"

# 2. 验证极线对齐
bash run_stereo.sh --epipolar_mode True \
  --chessboard_per_rows 11 \
  --chessboard_per_cols 8 \
  --chessboard_square_size 0.06

# ✅ 成功标志:<= 1px = 95%+

# 3. 测试深度精度
# 在 0.5m, 1m, 2m, 3m, 4m 放置物体,对比实际距离与深度输出

参考资源

资源 链接
社区标定教程 [132GS MIPI 双目相机][RDK X5][如何自行标定相机]
深度精度调试 RDK-X5 双目深度算法精度差
官方 stereonet 文档 hobot_stereonet 流程

总结

问题 解决方案
top is not left image 报错 使用 EEPROM 参数创建标定文件
测距不准 先解决极线对齐,再调整滤波参数
未来 EEPROM 自动读取 等待官方新版本开放

建议立即执行方案 1,从日志提取 EEPROM 参数创建标定文件,这应该能解决 top is not left image 问题。有进展请更新帖子!