6.1.2   Tilted Camera Setup

In case the 3D sensor is tilted with respect to the background plane, in a first step, it can be approximated by a plane estimation. In a second step the point cloud will be leveled such that the above-mentioned method can be used in order to remove the background plane.
  1. Acquire a reference scene. Then, define a ROI on gray values that describe the background plane. The approximate background plane can be estimated by the following lines of codes:
      
    fit_surface_first_order (ROI, ImageZ, 'regression', 5, 2, Alpha, Beta, Gamma)
    get_image_size (Z, Width, Height)
    gen_image_surface_first_order (BackgroundPlane, 'real', Alpha, Beta, Gamma, \
                                   Width/2, Height/2, Width, Height)
        
  2. Remove the background plane from the online acquired scene by subtracting the estimated plane. This way the scene is leveled and hence a hardcoded threshold can be applied:
     
    sub_image (ImageZ, BackgroundPlane, ImageSub, 1, 0)
    threshold (ImageSub, Regions, MinThres, MaxThres)
    reduce_object_model_3d_by_view (Regions, Scene, [], [], SceneReduced)
        
The HDevelop example remove_background_for_object_location.hdev demonstrates this workflow for a given application.

a) Scene b) Z-image c) Estimated plane d) Reduced scene

Figure 6.2: By estimating the pose of the background plane in 3D space, it can be subtracted out.