Configure a Join Color Depth View

Combine the streams of a color and a depth camera already registered in your config to create a view that outputs the combined and aligned image.

This specific model is good if you don’t need to align the streams. If you need to adjust the alignment between the depth and color frames, use the align_color_depth_extrinsics model or thealign_color_depth_homography model.

On the COMPONENTS subtab, navigate to the Create Component menu. Enter a name for your camera, select the type camera, and select the join_color_depth model.

Creation of a join color depth view in the Viam app config builder.

Fill in the attributes for your join color depth view:

Configuration of a join color depth view in the Viam app config builder.
{
    "name": "<camera_name>",
    "type": "camera",
    "model" : "join_color_depth",
    "attributes": {
        "output_image_type": "<color|depth>",
        "color_camera_name": "<camera_name>",
        "depth_camera_name": "<camera_name>",
        "intrinsic_parameters": {
          "width_px": <integer>, # the expected width of the aligned pic
          "height_px": <integer>, # the expected height of the aligned pic
          "fx": <float64>,
          "fy": <float64>,
          "ppx": <float64>,
          "ppy": <float64>
        },
        "distortion_parameters": {
          "rk1": <float64>,
          "rk2": <float64>,
          "rk3": <float64>,
          "tp1": <float64>,
          "tp2": <float64>
        },
        "debug": <boolean>
    }
}

The following attributes are available for join color depth views:

NameInclusionDescription
output_image_typeRequiredSpecify color or depth for the output stream.
color_camera_nameRequiredName of the color camera to pull images from.
depth_camera_nameRequiredName of the depth camera to pull images from.
intrinsic_parametersRequiredThe intrinsic parameters of the camera used to do 2D <-> 3D projections:
  • width_px: The expected width of the aligned image in pixels.
  • height_px: The expected height of the aligned image in pixels.
  • fx: The image center x point.
  • fy: The image center y point.
  • ppx: The image focal x.
  • ppy: The image focal y.
distortion_parametersOptionalModified Brown-Conrady parameters used to correct for distortions caused by the shape of the camera lens:
  • rk1: The radial distortion x.
  • rk2: The radial distortion y.
  • rk3: The radial distortion z.
  • tp1: The tangential distortion x.
  • tp2: The tangential distortion y.
debugOptionalEnables the debug outputs from the camera if true. Defaults to false.

View the camera stream

Once your camera is connected, go to the CONTROL tab, and click on the camera’s dropdown menu. Toggle “View Camera”. If everything is configured correctly, you will see the live video feed from your camera.

Example Camera view inside Viam app

Next Steps