Texturing 3D Data

In the previous topic we have seen the necessary steps for computing a PointMap. This topic describes how this point map can be rendered with texture.

The NxLib provides the RenderPointMap command which can be used to render a point map with or without texture. If enabled, the command stores the resulting texture information in the global /Images/RenderPointMapTexture node.

Texture From a Separate Sensor

One way to render the PointMap with texture is a multi-camera setup in which a separate (color) sensor has been calibrated to the stereo camera as described in this guide. In this case the RenderPointMap command uses the Camera parameter to determine the source image for the texture.

Texture From the Stereo Camera

Another way is to use the stereo camera’s left sensor as the source for the texture. This is the default behavior if the Camera parameter is not given.

When using the stereo camera’s left sensor as the source for the texture and we are capturing images with the projector turned on, the projector pattern would be visible in the resulting texture.

Removing the Projector Pattern

In order to get rid of the projector pattern, the NxLib provides the ComputeTexture command.

When you captured FlexView image pairs, the command uses the information in the different images to reconstruct an image without the pattern. The more image pairs you capture, the smaller the pattern residues in the texture image.

If you can only capture a small amount of image pairs and require a higher texture quality than those images would produce, you can alternatively disable the projector for a single shot. The command will then simply rectify and save this image as the texture.

After the command was called once, the reconstructed image is written to the RectifiedTexture node. This pattern-free texture image then gets used predominantly by the RenderPointMap command, because it first looks at this node in case the Texture parameter is enabled (which it is globally by default).

The following two code examples show how to use the command either with FlexView enabled or in single shot mode.

NxLibItem root;                              // References the tree's root item at path "/"
NxLibItem camera = root[itmCameras]["1234"]; // References the camera's item at path "/Cameras/BySerialNo/1234"

NxLibCommand open(cmdOpen);
open.parameters()[itmCameras] = camera[itmSerialNumber].asString();
open.execute();

// Set FlexView to 16, the more images the higher the texture quality
camera[itmParameters][itmCapture][itmFlexView] = 16;

// Capture with FlexView enabled
NxLibCommand(cmdCapture).execute();

// Compute texture without projector pattern from FlexView images and store it in camera/Images/RectifiedTexture
NxLibCommand(cmdComputeTexture).execute();

// Render the point map with texture (automatically taken from camera/Images/RectifiedTexture)
NxLibCommand(cmdComputeDisparityMap).execute();
NxLibCommand(cmdComputePointMap).execute();
NxLibCommand(cmdRenderPointMap).execute();