Depth Estimation

The Depth Estimation node allows you to estimate the relative distance of objects within an image using an ONNX model. It generates a depth map that represents how far each pixel is from the camera and can optionally create a visual image of the depth map using different color styles.

Inputs

General

  • Property: input
  • Type: object, buffer, string or tensor.
  • Description: The input image or tensor to classify. See the Details section for supported input formats.
Supported Input Formats

Typically, the input would be an image which could be:

  • A Buffer object containing the binary image data (e.g. from a file node or http request node)
  • A base64-encoded string.
  • A Jimp image object (e.g, output from node-red-contrib-image-tools).
Tensor input

Alternatively, you can supply a pre-processed tensor in the following format:

{
"data": [0.0, 0.1, 0.2, ...],
"type": "float32",
"dim": [1, 3, 224, 224]
}

This represents a flat array of pixel values, the data type of the tensor, and its dimensions (for example, [batch_size, channels, height, width]).

TIP: If the model supports batching, the input can be an array of images in one of the supported formats.

Model Selection

You can specify the model in two ways:

When specifying a model by name, you can define the data type to use when loading it. Supported types include:

  • auto — Automatically selects the most suitable type.
  • fp32 — Standard 32-bit floating-point model.
  • fp16 — Half-precision 16-bit floating-point model.
  • int8 — 8-bit integer quantized model.
  • uint8 — 8-bit unsigned integer model.
  • q8 — Quantized Int8 model (default).
  • q4 — Quantized Int4 model.
  • q4f16 — Quantized Int4 with Float16 model.
  • bnb4 — BNB4 quantized model.

Configuration

Output Image

If enabled, the node generates a visual representation of the depth map based on the selected style and alpha values. The output will include both the raw depth data and a generated image:

{
"data": { ... },
"image": "Buffer",
"width": 640,
"height": 480
}

If disabled, only the raw depth data will be included in the output.

style

Specifies the color map used when creating the depth visualization.

Available options include: grayscale, jet, hot, hsv, spring, summer, autumn, winter, bone, copper, viridis, inferno, magma, plasma, rainbow, cool, warm, earth, blackbody, electric, velocity-blue, velocity-green, and many more.

These styles correspond to common colormaps used in computer vision to represent depth or heat data.

alpha

Defines the transparency of the generated depth image. You can use either a single value or an array of two values:

  • A single value (e.g., 0.5) applies a uniform transparency.
  • An array [0.3, 0.8] defines a transparency range from the nearest (0.3) to farthest (0.8) objects.

Example Flow