Color Space

This function block converts an image from one color space to another. It is useful for preparing images for analysis, visualization, or further processing by other blocks.

πŸ“₯ Inputs

Image Any This socket accepts the input image to be converted. It can handle color or grayscale images from cameras or image files.

πŸ“€ Outputs

Image Any This socket provides the converted image in the selected color space.

πŸ•ΉοΈ Controls

Conversion Type A dropdown where you choose the desired color conversion. Common choices include conversions to/from:

  • BGR and RGB

  • BGR and RGBA / BGRA

  • BGR and GRAY

  • BGR and HSV

  • BGR and Lab Choose the conversion that matches the expected format of downstream blocks or visualization tools.

🎨 Features

  • Fast color space conversions for real-time workflows.

  • Supports common conversions used by analysis and detection blocks (grayscale, HSV, RGB, RGBA, Lab, etc.).

  • Keeps image size unchanged β€” only channel interpretation and channel count may change.

πŸ“ Usage Instructions

  1. Provide an image to the Image Any input (for example from Camera USB, Load Image, or Stream Reader).

  2. Select the desired option in Conversion Type.

  3. Use the converted image from the output socket for downstream blocks (for example visualization or detectors).

πŸ“Š Evaluation

When executed, this block reads the input image, applies the chosen color conversion, and outputs the converted image immediately for the next steps in your workflow.

πŸ’‘ Tips and Tricks

  • If you need a single channel (intensity) image for detectors, choose BGR2GRAY and then feed the result to Edge Filter, Sobel Filter, Image Threshold, or Find Contour.

  • For color-based masking, convert to BGR2HSV first and then use HSV Filter or RGB Mask for more robust separation.

  • When preparing images for model-based blocks (for example Object Detection (D-FINE) or Mask Detection), ensure the channel order matches the model expectation (use BGR2RGB if the model expects RGB).

  • Use Split Image after conversion to access individual channels, or use Merge Channels to combine edited channels back into a single image.

  • If images are too large for some AI blocks, use Image Resizer before or after conversion to balance speed and quality.

  • For noisy inputs, run Blur or Denoising before converting to improve downstream results.

(hint: useful companion blocks β€” Show Image, Image Resizer, Blur, Denoising, HSV Filter, Image Threshold, Split Image, Merge Channels, Find Contour, Object Detection (D-FINE))

πŸ› οΈ Troubleshooting

  • Color looks incorrect after conversion

    • Check whether the downstream block expects RGB or BGR ordering. Try switching between BGR2RGB and BGR2GRAY/other options as needed.

  • Unexpected number of channels (e.g., 3 vs 4)

    • Convert to or from an RGBA/BGRA option if transparency is required, or use Merge Channels / Split Image to manage channels explicitly.

  • Downstream detectors failing after conversion

    • Ensure the converted image format (grayscale vs color, channel order) matches the requirements of the detector. Adjust conversion and optionally add Image Resizer or Normalize Image to match expected input sizes and ranges.

Last updated