这件事不需要等群里或邮件——它不依赖任何未公开资料,两次测量就能定死,而且都不用看照片猜。
先说清依据:官方硬件说明只标「① 右目 MIPI Camera 接口(同时走 IMU)」「② 左目 MIPI Camera 接口」,标的是 FPC 接口,没有定义镜头面朝你时哪边是左。所以对 stereonet 来说,真正可用的标准是:校正后右图必须落在左图的图像 x 正方向一侧,即标定结果 T[0] > 0。下面两步就是为此定名。
第一步:红圈那只镜头对应上半还是下半(用亮度,不用肉眼)
source /opt/tros/humble/setup.bash
ros2 run mipi_cam mipi_cam --ros-args -p device_mode:="dual" \
-p out_format:="bgr8" -p dual_combine:=2 -p framerate:=10.0 -p gdc_enable:=false
# ~/lr_check.py
import os, rclpy, cv2
from rclpy.node import Node
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
class N(Node):
def __init__(self):
super().__init__('lr_check'); self.b = CvBridge(); self.f = None
self.create_subscription(Image, '/image_combine_raw', self.cb, 10)
def cb(self, m): self.f = self.b.imgmsg_to_cv2(m, 'bgr8')
rclpy.init(); n = N()
while n.f is None: rclpy.spin_once(n, timeout_sec=0.5)
img = n.f; h, w = img.shape[:2]; half = h // 2
cv2.imwrite(os.path.expanduser('~/lr_check.png'), img)
print(f'{w}x{h} top={img[:half].mean():.1f} bottom={img[half:].mean():.1f}')
另一终端跑 python3 ~/lr_check.py:先不遮挡记一组 top/bottom,再用纸片贴住红圈镜头口再跑一组。数值明显掉下去的那一半,就是红圈那只。两个坑:遮挡后数字几乎不变 → 还有别的 mipi_cam 在发旧帧,先 pkill -f mipi_cam 重来;两次必须是同一条命令起的流。
第二步:哪一半是右目(用你已有的棋盘格图)
import cv2, glob, os
L = sorted(glob.glob(os.path.expanduser('~/calib_data/left_*.png')))[0]
R = sorted(glob.glob(os.path.expanduser('~/calib_data/right_*.png')))[0]
def pts(p, rot):
g = cv2.rotate(cv2.imread(p, 0), rot)
ok, c = cv2.findChessboardCorners(g, (11, 8)); assert ok, p
return c.reshape(-1, 2), g.shape
for name, rot in [('CW', cv2.ROTATE_90_CLOCKWISE), ('CCW', cv2.ROTATE_90_COUNTERCLOCKWISE)]:
pl, sh = pts(L, rot); pr, _ = pts(R, rot)
d = (pr - pl).mean(0)
cv2.imwrite(os.path.expanduser(f'~/sample_{name}.png'), cv2.rotate(cv2.imread(L, 0), rot))
print(name, sh, 'dx=%.2f dy=%.2f' % (d[0], d[1]))
先打开 ~/sample_CW.png、~/sample_CCW.png,选画面正立(椅子、棋盘格竖直)的那张对应方向;该方向下 dx < 0 表示 right_*.png 确实是物理右目,dx > 0 说明切图时命名反了,交换即可。
两步交叉即可定死:第一步得"红圈 → 上半/下半",第二步得"半幅 → 左/右"。定完按这个方向重跑标定,验收只看三点:单目变 1280×1088、T ≈ (+80, 0, 0) mm 且 T[0] 为正、双目 RMS 仍 0.2px 量级;运行时 mipi_rotation 必须与标定时一致。把两次 top/bottom 和 dx 贴出来,我按确认后的对应关系把切图、重标、接 stereonet 的命令一次写全。