imaqColorThreshold

NI Vision for LabWindows/CVI Function

imaqColorThreshold

Usage

int imaqColorThreshold(Image* dest, const Image* source, int replaceValue, ColorMode mode, const Range* plane1Range, const Range* plane2Range, const Range* plane3Range);

Purpose

Thresholds a color image. The function selects a pixel if all three color components fall within the specified range. The function replaces the value of selected pixels with the given replacement value and sets the value of unselected pixels to 0.

Note  This function does not support the CIE L*a*b* and CIE XYZ color modes.

Image Types Supported

IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL

Parameters

Name

Type

Description

dest Image* The destination image. This image must be an IMAQ_IMAGE_U8 image.
source const Image* The image to threshold.
replaceValue int The value the function assigns to selected pixels.
mode ColorMode The color space to perform the threshold in.
plane1Range const Range* The selection range for the first plane of the image. Set this parameter to NULL to use a selection range from 0 to 255.
plane2Range const Range* The selection range for the second plane of the image. Set this parameter to NULL to use a selection range from 0 to 255.
plane3Range const Range* The selection range for the third plane of the image. Set this parameter to NULL to use a selection range from 0 to 255.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().

Parameter Discussion

plane1Range—The color plane depends on the mode, as follows:

IMAQ_RGB red plane
IMAQ_HSL hue plane
IMAQ_HSV hue plane
IMAQ_HSI hue plane

plane2Range—The color plane depends on mode, as follows:

IMAQ_RGB green plane
IMAQ_HSL saturation plane
IMAQ_HSV saturation plane
IMAQ_HSI saturation plane

plane3Range—The color plane depends on mode, as follows:

IMAQ_RGB blue plane
IMAQ_HSL luminance plane
IMAQ_HSV value plane
IMAQ_HSI intensity plane