imaqThreshold

NI Vision for LabWindows/CVI Function

imaqThreshold

Usage

int imaqThreshold(Image* dest, const Image* source, float rangeMin, float rangeMax, int useNewValue, float newValue);

Purpose

Thresholds an image. The function sets pixels values outside of the given range to 0. The function sets pixel values within the range to a given value or leaves the values unchanged.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

dest Image* The destination image.
source const Image* The source image.
rangeMin float The lower boundary of the range of pixel values to keep.
rangeMax float The upper boundary of the range of pixel values to keep.
useNewValue int Set this parameter to TRUE to set the pixel values within [rangeMin, rangeMax] to the value specified in newValue. Set this field to FALSE to leave the pixel values unchanged.
newValue float If you set useNewValue to TRUE, newValue is the replacement value for pixels within the range. If you set useNewValue to FALSE, the function ignores this parameter.

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().