| Developers' Corner

Introduction to XYZ-Mappings (Part 1)

a) Intensity Image
a) Intensity Image
b) X-Image
b) X-Image
c) Y-Image
c) Y-Image
d) Z-Image
d) Z-Image

In the context of 3D applications in HALCON, you have surely already heard the terms “3D mappings”, “XYZ-mappings” or “XYZ-images”. Many 3D sensors provide these XYZ-mappings along with the point cloud. In this and follow-up technical articles, we want to give you an overview about these XYZ-mappings.

In this article, we discuss the topics What are XYZ-mappings and give a short preview to the topic Why is using XYZ-mappings beneficial for many 3D applications. In the follow-up article, we will answer the question Why is using XYZ-mappings beneficial for many 3D applications in more detail.

What are XYZ-mappings?

XYZ-mappings are images that map 3D coordinates into 2D coordinates, i.e., the X-coordinates are encoded as gray-values in the X-image, the Y-coordinates are encoded as gray-values in the Y-image and the Z-coordinates are encoded as gray-values in the Z-image.

Let’s have a look at some example data (also used in our standard examples find_surface_model_with_edges.hdev and find_box_3d.hdev.)

On the right side you see four images referring to the same 3D scene. The intensity looks like a “normal” 2D image that could be used for common 2D image processing. In the XYZ-images, we basically see the same structure as in the intensity image (the three boxes); however, the images do not contain intensity values, but the X-, Y, and Z-coordinates of the related 3D points. So, in the XYZ-images, the 3D point coordinates are sorted row- and column-wise into 2D images. In the example images, you also see the required conventions for edge-supported surface based matching:

  • the X-mapping has increasing gray-values from left to right,
  • the Y-mapping has increasing gray-values from top to bottom and
  • the Z-mapping has increasing gray-values for object parts further away from the camera.

To convert XYZ-images into a 3D object model, you can use the operator

xyz_to_object_model_3d (X, Y, Z, ObjectModel3D)

The other way round, you can use

object_model_3d_to_xyz (X, Y, Z, ObjectModel3D, 'from_xyz_map', [], [])// ObjectModel3D must contain mappings

For further general information about 3D object models, please have a look at our Solution Guide III-C 3D Vision, chapter 2.3 3D Object Models.

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

In summary, using XYZ-mappings increases speed and flexibility of an application. Most of the relevant 3D operators contain a mapping-based mode, e.g. triangulate_object_model_3d, sample_object_model_3d and reduce_object_model_by_view.

Moreover, on the XYZ-mappings, HALCON's powerful 2D library can be used in order to prepare the point cloud in an intuitive, efficient and flexible way for the main part of the application, such as 3D object localization based on the surface-based matching. More details will be given in the follow-up technical article.