Texturing 3D Data

Note

This guide is about capturing texture images with stereo cameras. If you want to use a separate color sensor as a texture image, please see this guide.

The NxLib allows to combine a stereo camera’s 3D data with texture images in different ways.

Capturing Texture Images

The normal images from stereo cameras which are used for computing 3D data are not suitable as a texture, because they contain the projector pattern. Stereo cameras allow capturing of separate texture images images in addition to the projector images.

Capturing of texture images can be set up using the Texture parameter nodes. Texture images have to be rectified explicitly using the ComputeTexture (or RectifyImages) command.

// Assuming `camera` is an NxLibItem pointing at the camera node of an open stereo camera.

// Enable texture mode with default parameters (one additional image with separate auto
// exposure and the front light enabled instead of the projector).
camera[itmParameters][itmCapture][itmTexture][itmEnabled] = true;

// Executing Capture will capture raw images with projector as well as a raw texture image
// with the front light enabled.
NxLibCommand(cmdCapture).execute();

// Computing the disparity map will implicitly rectify the raw images but not the texture image.
NxLibCommand(cmdComputeDisparityMap).execute();
NxLibCommand(cmdComputePointMap).execute();

// Rectify the texture image explicitly.
NxLibCommand(cmdComputeTexture).execute();

// The left texture image can be overlayed with the point map.
NxLibItem leftTextureImage = camera[itmImages][itmRectifiedTexture][itmLeft];

Computing Texture from Projector Images

ComputeTexture can be used to reconstruct a texture image without the projector pattern from a FlexView sequence of images with projector pattern. This can save the time for capturing an additional image. The quality of this image will improve when using more FlexView images, but it will be worse than a dedicated texture image.

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

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

// Compute texture without projector pattern from FlexView images.
NxLibCommand(cmdComputeTexture).execute();

// Use the texture image like an explicitly capture one.
NxLibItem leftTextureImage = camera[itmImages][itmRectifiedTexture][itmLeft];