【问题标题】:Align depth image to RGB image将深度图像与 RGB 图像对齐
【发布时间】:2014-08-17 05:21:50
【问题描述】:

我正在尝试使用 Kinect 通过 Python 和 libfreenect 捕获的图像生成点云,但我无法将深度数据与 Kinect 获取的 RGB 数据对齐。

我申请了Nicolas Burrus's equation,但两张图片转得更远了,是不是我的代码有问题:

cx_d = 3.3930780975300314e+02
cy_d = 2.4273913761751615e+02
fx_d = 5.9421434211923247e+02
fy_d = 5.9104053696870778e+02
fx_rgb = 5.2921508098293293e+02
fy_rgb = 5.2556393630057437e+02
cx_rgb = 3.2894272028759258e+02
cy_rgb = 2.6748068171871557e+02
RR = np.array([
    [0.999985794494467, -0.003429138557773, 0.00408066391266],
    [0.003420377768765,0.999991835033557, 0.002151948451469],
    [-0.004088009930192, -0.002137960469802, 0.999989358593300 ]
])
TT = np.array([ 1.9985242312092553e-02, -7.4423738761617583e-04,-1.0916736334336222e-02 ])

# uu, vv are indices in depth image
def depth_to_xyz_and_rgb(uu , vv):

    # get z value in meters
    pcz = depthLookUp[depths[vv , uu]]

    # compute x,y values in meters
    pcx = (uu - cx_d) * pcz / fx_d
    pcy = (vv - cy_d) * pcz / fy_d

    # apply extrinsic calibration
    P3D = np.array( [pcx , pcy , pcz] )
    P3Dp = np.dot(RR , P3D) - TT

    # rgb indexes that P3D should match
    uup = P3Dp[0] * fx_rgb / P3Dp[2] + cx_rgb
    vvp = P3Dp[1] * fy_rgb / P3Dp[2] + cy_rgb

    # return a point in point cloud and its corresponding color indices
    return P3D , uup , vvp

我做错了什么吗?任何帮助表示赞赏

【问题讨论】:

    标签: computer-vision kinect openni depth openkinect


    【解决方案1】:

    首先,检查您的校准编号。您的旋转矩阵大约是恒等式,并且假设您的校准框架是公制的,您的平移向量表示第二个相机的侧面距离为 2 厘米,深度为 1 厘米。这是否与您的设置大致匹配?如果不是,您可能使用了错误的缩放比例(可能为校准目标的特征尺寸使用了错误的数字 - 棋盘格?)。

    您的代码看起来是正确的 - 您正在以已知深度重新投影深度相机的像素,并将其投影回第二个相机以获得相应的 rgb 值。

    我想我会检查您是否在正确的方向上使用坐标变换。 IIRC,OpenCV 将其生成为 [R | t],但您将其用作 [R | -t],这看起来很可疑。也许您打算使用它的倒数,即 [R' | -R'*t ],这里我用撇号表示换位。

    【讨论】:

      猜你喜欢
      • 2021-06-13
      • 1970-01-01
      • 2019-10-31
      • 2016-07-01
      • 1970-01-01
      • 2011-10-14
      • 2014-03-17
      相关资源
      最近更新 更多