You are here: Start » Filter Reference » Image Metrics » ColorDistanceImage
Compares each pixel with the specified color using chromatic and non-chromatic information.
Name | Type | Range | Description | |
---|---|---|---|---|
![]() |
inImage | Image | Unsigned color image used in comparison | |
![]() |
inRoi | Region* | Range of pixels to be processed | |
![]() |
inRgbColor | Pixel | Color to compare the image to | |
![]() |
inChromaAmount | Real | 0.0 - 1.0 | Proportion of chromatic information in distance computation |
![]() |
outValueImage | Image | Unsigned image of distances |
Requirements
For input inImage only pixel formats are supported: 1xuint8, 2xuint8, 3xuint8, 4xuint8.
Read more about pixel formats in Image documentation.
Applications
Description
The operation computes the distance between each pixel of inImage and a specified color, presenting result as a monochromatic image. Input image should be in RGB color space.
The distance between pixels is computed using two measures:
- Value distance - the difference between average channel values
- Chromatic distance - euclidean distance between pixels normalized to the same value level
The resulting distance is computed as a weighted average of these two values, parameter inChromaAmount ( 0.0 - 1.0 ) being the weight of the chromatic distance, and 1 - inChromaAmount being the weight of the value distance.
Examples
![]() |
![]() |
ColorDistanceImage run with inRgbColor = , inChromaAmount = 0.8
Hardware Acceleration
This operation supports automatic parallelization for multicore and multiprocessor systems.
Errors
This filter can throw an exception to report error. Read how to deal with errors here: Error Handling
Error type | Description |
---|---|
RuntimeError | Each pixel component of inRgbColor must be nonnegative in ColorDistanceImage |
Complexity Level
This filter is available on Advanced Complexity Level.
See Also
- ColorDistance – Compares two pixels using chromatic and non-chromatic information. Assumes RGB-like color space.
- ThresholdImage_Color – Transforms each pixel value to maximum or minimum depending on the distance from a given color.
- ThresholdToRegion_Color – Creates a region containing image pixels with values close to the given color.