MVTec Software GmbH

Introduction to XYZ-Mappings (Part 2)

This month’s technical article continues our introduction to XYZ-mappings. In the last article, we answered the question "What are XYZ-mappings?" and gave a short preview towards "Why is using XYZ-mappings beneficial for many 3D applications?". Today, we will answer this question in more detail.



Regiongrowing on Z-image

Selected regions

Segmented 3D point cloud

Why is using XYZ-mappings beneficial for many 3D applications?

Using XYZ-mappings in your 3D application can be beneficial both for the preparation of the point cloud as well as for the main part of an application. In the following, we cover three main advantages and give some explanations and concrete examples. This list and the examples do not claim completeness but shall give you an overview.

1) Speed-up of 3D operators

Many operations on 3D data require information about the neighborhood between the 3D points. For point clouds containing XYZ-mappings, the neighborhood is known from the unique relation of the 3D points in the 2D XYZ-mappings, and therefore expensive 3D operations can be sped up.


Many HALCON operators provide a method explicitly using the XYZ-mappings, like surface_normals_object_model_3d, sample_object_model_3d, reduce_object_model_by_view, or triangulate_object_model_3d. You can have a look at the operator reference to check the available methods.

2) Flexibility (and speed-up) by using 2D operators

Furthermore, you can use many of HALCON’s existing powerful 2D operators on the XYZ-images, e.g. for segmentation and filtering, so you have a much wider range of possibilities. Often, using 2D operators on the XYZ-images is also faster than comparable 3D operators.


Let’s imagine we want to separate the boxes from the background in the example images we already used last time. When working on the 3D object model, we could for example use the following operators:

connection_object_model_3d (OM3DScene, 'distance_3d', 0.01, ObjectModel3DConnected) select_object_model_3d (ObjectModel3DConnected, 'num_points', 'and', 5000, 500000, ObjectModel3DSelected) union_object_model_3d (ObjectModel3DSelected, 'points_surface', ObjectModel3DBoxes1)

Working on the 2D XYZ-images, we could alternatively use:

object_model_3d_to_xyz (X, Y, Z, OM3DScene, 'from_xyz_map', [ ], [ ]) regiongrowing (Z, Regions, 3, 3, 0.01, 100) select_shape (Regions, SelectedRegions, 'area', 'and', 5000, 500000) union1 (SelectedRegions, RegionUnion) reduce_object_model_3d_by_view (RegionUnion, OM3DScene, [ ], [ ], ObjectModel3DBoxes2)

The intermediate results of this approach are shown in the photos on the right. While both the 3D and 2D method provide the same or similar results, the second method is usually faster than the first method, especially when working with big point clouds. In this example, a speed-up of up to 400% can be reached.


3) 3D operators requiring XYZ-images

Operators working with 3D edges strongly require XYZ-images, e.g. edges_object_model_3d, find_box_3d or the edge-supported surface-based matching. So, if you want to use these methods, you need 3D object models containing XYZ-mappings.



Overall, using 3D object models containing XYZ-mappings can increase speed, flexibility and robustness of your application distinctly. Thus, it is highly recommended to work with XYZ-images in 3D processing. Further information and examples (e.g. for background removal) can also be found in the new technical note %HALCONROOT%/doc/pdf/manuals/surface_based_matching.pdf which we provide with HALCON 20.05 Progress.