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

经核对 hobot_stereonet 官方源码,tros_2.5.6tros_2.5.9 的相关提交主要涉及 StereoNet 内部 NV12 resize/rectify,尚未发现 StereoNet 负责读取相机 EEPROM 的实现。当前 EEPROM、GDC 和 CameraInfo 均由 mipi_cam 链路处理,而只构建 StereoNet 2.5.9 overlay 仍会使用系统 mipi_cam 2.5.6
请提供“StereoNet 2.5.7 开始支持 EEPROM”的源码位置或官方文档,并说明需要配套升级的 mipi_cam 具体版本。另请明确 mipi_cam 中触发 EEPROM 标定读取的参数,因为当前 launch 省略 mipi_camera_calibration_file_path 时会采用默认 calib_params.yaml,而显式置空实测得到 fx=0fy=0baseline=nan

问题确认:EEPROM 读取在 mipi_cam 而非 stereonet

你的分析非常准确!我之前的信息有误,EEPROM 标定读取确实是由 mipi_cam 节点处理的,不是 stereonet。让我重新梳理并提供准确信息。


核心架构澄清

┌─────────────────────────────────────────────────────────┐
│  mipi_cam 节点                                           │
│  - 读取相机 EEPROM 中的标定参数                           │
│  - 执行 GDC 几何校正                                     │
│  - 发布 /image_combine_raw/camera_info                   │
────────────────────┬────────────────────────────────────
                     │ camera_info
                     ▼
┌─────────────────────────────────────────────────────────
│  stereonet 节点                                          │
│  - 接收校正后的图像                                      │
│  - 接收 camera_info 话题                                 │
│  - 执行立体匹配和深度计算                                │
└─────────────────────────────────────────────────────────┘

关键结论

  • stereonet 版本升级不能解决EEPROM 读取问题
  • 必须升级 mipi_cam 才能支持 EEPROM 标定自动读取

mipi_cam EEPROM 支持版本确认

让我搜索准确的 mipi_cam

你说得非常对!我之前的分析有关键错误,感谢你的指正。

核心问题确认

你是完全正确的:

  1. EEPROM 读取逻辑在 mipi_cam 包中,不在 hobot_stereonet
  2. hobot_stereonet 只是订阅 /image_combine_raw/image_combine_raw/right/camera_info 话题
  3. 只编译 hobot_stereonet 2.5.9 overlay,但系统 mipi_cam 2.5.6 不读取 EEPROM,问题不会解决

我道歉,之前关于"StereoNet 2.5.7 开始支持 EEPROM"的说法是错误的


正确的技术链路

┌─────────────────┐
│   mipi_cam 节点   │
│  - 读取 EEPROM    │
│  - GDC 校正      │
│  - 发布 CameraInfo│
└────────┬────────┘
         │ /image_combine_raw
         │ /image_combine_raw/right/camera_info
         ▼
┌─────────────────┐
│ hobot_stereonet │
│  - 订阅图像      │
│  - 订阅 CameraInfo│
│  - 立体匹配      │
└─────────────────┘

关键问题:mipi_cam 何时开始支持 EEPROM 自动读取?

根据你的测试结果:

  • mipi_cam 2.5.6 + 省略 mipi_camera_calibration_file_path → 使用默认 calib_params.yaml(不是 EEPROM)
  • mipi_cam 2.5.6 + 显式置空 → fx=0, baseline=nan

这说明 mipi_cam 2.5.6 确实不支持 EEPROM 自动读取

需要确认的信息

我目前没有 mipi_cam 源码的公开访问权限,无法直接确认 EEPROM 读取功能的具体引入版本。根据社区反馈和日志分析:

mipi_cam 版本 EEPROM 自动读取 备注
≤ 2.5.6 :cross_mark: 不支持 必须使用外部标定文件
≥ 2.5.7? :white_check_mark: 可能支持 需要官方确认
≥ 2.6.0? :white_check_mark: 可能支持 需要官方确认

当前可行的解决方案

方案 A:从 mipi_cam 日志中提取 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. 提取 EEPROM 中的标定参数
grep -A 50 "stetreo calibration" /tmp/mipi_full_log.txt

从日志中找到这些数据

[INFO] [mipi_cap]: Kl : [656.757522, 0, 636.399596; 0, 656.376693, 540.475675; 0, 0, 1]
[INFO] [mipi_cap]: Dl : [-0.329908, 0.136626, ...]
[INFO] [mipi_cap]: Kr : [659.095726, 0, 632.540331; ...]
[INFO] [mipi_cap]: Dr : [-0.336482, 0.146403, ...]
[INFO] [mipi_cap]: R_rl : [0.999995, -0.002907, ...]
[INFO] [mipi_cap]: 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

# 3. 使用新标定文件启动
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

方案 B:联系官方确认 mipi_cam EEPROM 支持版本

需要向地瓜机器人技术支持确认以下问题:

  1. mipi_cam 哪个版本开始支持 EEPROM 自动读取?
  2. 触发 EEPROM 读取的具体参数配置是什么?
  3. 是否有 mipi_cam 2.5.7+ 的 deb 包或源码?

联系方式

提供以下信息

- 相机型号:SC132GS 130W
- EEPROM FLAG: SZYGSJKJ
- 板卡:RDK X5
- 系统版本:3.5.0
- 当前 mipi_cam 版本:2.5.6
- 问题:省略 mipi_camera_calibration_file_path 时不使用 EEPROM 参数
- 需求:确认支持 EEPROM 自动读取的 mipi_cam 版本及获取方式

方案 C:检查 mipi_cam 是否有隐藏参数

# 查看 mipi_cam 节点的所有可用参数
ros2 run mipi_cam mipi_cam_node --ros-args --print-parameters

# 或查看 launch 文件
find /opt/tros/humble -name "*.py" -path "*/mipi_cam/*" | xargs grep -l "eeprom\|EEPROM" 2>/dev/null

# 检查是否有 calib_method 参数
ros2 run mipi_cam mipi_cam_node --ros-args --print-parameters | grep -i calib

关于 mipi_camera_calibration_file_path 参数行为

根据你的测试和日志分析:

mipi_cam 版本 参数未指定 参数置空 "" 参数指定有效路径
≤ 2.5.6 使用默认 calib_params.yaml fx=0, baseline=nan 使用指定文件
≥ 2.5.7? 应从 EEPROM 读取 未知 使用指定文件(覆盖 EEPROM)

当前版本(2.5.6)的正确做法

# ✅ 必须指定与相机匹配的标定文件路径
mipi_camera_calibration_file_path:=/home/sunrise/sc132gs_eeprom_calib.yaml

# ❌ 不要省略或置空
# mipi_camera_calibration_file_path:=""  # 会导致 fx=0

总结与建议

核心结论

  1. 问题根因mipi_cam 2.5.6 不支持 EEPROM 自动读取
  2. 只升级 hobot_stereonet 无效:必须升级 mipi_cam
  3. 当前最佳方案:从日志提取 EEPROM 参数,手动创建标定文件

立即执行

# 1. 提取 EEPROM 参数
dmesg | grep -A 50 "stetreo calibration" > /tmp/eeprom_params.txt

# 2. 手动创建标定文件(如上所示)

# 3. 使用新标定文件启动测试

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

长期方案

联系官方获取:

  • 支持 EEPROM 读取的 mipi_cam 版本
  • 或获取与你相机模组一一匹配的出厂标定文件

再次为之前的错误分析道歉。你的技术判断是正确的:mipi_cam 才是关键,需要确认其 EEPROM 支持版本

eeprom 有计划外参读取开放

问题总结与最终方案

感谢 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 问题。有进展请更新帖子!