Skip to content

blaze: Visualizing Depth Information as RGB Images#

You are using the Basler blaze-101 camera and would like to map the depth information to a color image.

You can find detailed information about how to visualize depth information as RGB images here.

This knowledge article provides some additional information.

The scaling factor is independent of whether the camera is operated in short or long range. The depth image is completely independent of the intensity image, that is, the calculation of the coordinates is independent of it. The calculation depends on how you capture the range map.

Range Maps Acquired Using either the blaze Legacy SDK or the pylon SDK#

The raw image captured with the pylon API or the ROS drivers is generated by mapping [0mm..10000mm] z-values to [0..65535] gray values.

Use the scaling factor given by gray2mm == Scan3dCoordinateScale. DepthMin and DepthMax parameters don't need to be taken into consideration.

For the blaze-101, gray2mm is a constant value and gray2mm = 10000/65535 = 0.15259. This results in:

Distance Measured [mm] = Gray_Value * gray2mm = Gray_Value * 0.15259

Range Map Acquired Using the blaze Viewer#

The blaze Viewer captures the point cloud data and generates its own range map from the 3D data. The only differences between a range map generated by the blaze Viewer and a "raw" depth image captured using the API are the different scales.

The blaze Viewer takes the acquired range maps and re-scales them, mapping [MinDepth..MaxDepth] z-values to [0..65535] gray values. This enhances the contrast of the displayed (and saved) images. In this case, the following formula has to be applied:

Distance Measured [mm] = DepthMin + (Pixel_Value x (DepthMax - DepthMin)) / 65535

Note that this mapping is the only processing on the depth data performed by the blaze viewer.

Info

In case you save range images as 8 bit images with the blaze viewer, the 16-bit data will be mapped to 8 bit. This means that [MinDepth..MaxDepth] z-values will be mapped to [0..255]. Thus for converting these 8 bit gray values to z-values, a different formula applies:

Distance Measured [mm] = DepthMin + (Pixel_Value x (DepthMax - DepthMin)) / 255

Using 8-bit range images is not recommended though, because the reduction to 256 different gray values causes a significant loss of precision due to the quantization error.

Back to Knowledge Articles