Closing Gaps of 3D Object Models with HALCON

Proper visualisation of 3D objects is becoming increasingly important. This requirement brings along another task: proper 3D object processing. In this context, HALCON introduced various tasks of object processing and visualisation such as mapping texture on 3D object models.

In this support article we want to highlight how to close gaps of a 3D object model, as it may be necessary for shadowed areas of 3D data acquired with a sheet of light or stereo setup. We begin with x-, y-, and z-images of the scene.

3dobject1

3dobject2

 

Depth image and 3D scene of a circular object which is placed above the plane. Due to shadows, data of the part above the circle is missing.

 

 

As the 3D object is generated from xyz-images, we can benefit from existing xyz-mapping. When using this attribute, there is an easy trick for closing the gaps of this model for the part where the points of the circular object and the plane are neighbors: Just perform a simple triangulation of your object model by calling prepare_object_model_3d:

get_object_model_3d_params (ObjectModel3D, ‘has_xyz_mapping’, XYZMapping)
if (XYZMapping = ‘true’)
prepare_object_model_3d (ObjectModel3D, ‘segmentation’, ‘true’, [], [])
endif

3dobject3

The gap can be closed for each neighbor point of the object and plane.

 

 

 

 

 

 

 

 

As you can see, the shadowed part does not have any neighbor points of the object and the plane and thus cannot be closed as desired. How do we close this gap? This can be done by harmonic_interpolation in combination with inpainting_aniso. This operator is helpful to produce relatively sharp edges with reconstruction. For more information about this workflow, have a look at HDevelop standard example inpainting_aniso.hdev.

3dobject4-png 3dobject5

 

 

Depth image with reconstructed shadowed part and its corresponding 3D scene.