6.1.2 倾斜相机设置

如果三维传感器相对于背景平面是倾斜的,第一步可以通过平面估算对其进行近似。第二步,对点云进行平移,以便使用上述方法去除背景平面。

  1. 获取参考场景。然后,在描述背景平面的灰度值上定义一个 ROI。近似背景平面可通过以下代码估算:

    intersection (ROI, ImageZ, RegionIntersection)
    fit_surface_first_order (RegionIntersection, ImageZ, 'regression', 5, 2, \
                             Alpha, Beta, Gamma)
    area_center (RegionIntersection, Area, Row, Column)
    get_image_size (ImageZ, Width, Height)
    gen_image_surface_first_order (BackgroundPlane, 'real', Alpha, Beta, Gamma, \
                                   Row, Column, Width, Height)
        

  2. 通过减去估计平面,从在线获取的场景中移除背景平面。这样,场景就会变得平整,从而可以应用硬编码阈值:

    sub_image (ImageZ, BackgroundPlane, ImageSub, 1, 0)
    threshold (ImageSub, Regions, MinThres, MaxThres)
    reduce_object_model_3d_by_view (Regions, Scene, [], [], SceneReduced)
        

HDevelop 示例 remove_background_for_object_location.hdev 演示了针对给定应用程序的这一工作流程。

a) 场景 b) Z 图像 c) 估计平面 d) 缩减场景

图 6.2:通过估计背景平面在三维空间中的姿态,可以将其减去。