Back to Adaptive Vision Studio website

You are here: Start » Filter Reference » Miscellaneous Image Transformations » cvThreshold

cvThreshold


Applies a fixed-level threshold to each image element.

Name Type Description
inImage Image Input image.
inThresh Real Threshold value.
inMaxVal Real Maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.
inThresholdType CvThresholdType Thresholding type.
inUseOtsu Bool Flag specifying if OTSU algorithm should be used.
outImage Image Output image

Description

cvThreshold applies fixed-level thresholding to single-channel images. It is used to get binary image out of a grayscale image or for removing a noise. It is filtering out pixels with too small or too large values. There are several types of thresholding supported by the function. They are determined by inThresholdType:

THRESH_BINARY

THRESH_BINARY_INV

THRESH_TRUNC

THRESH_TOZERO

THRESH_TOZERO_INV

Examples

Result of cvThreshold performed on the sample image with inThresh = 128, inMaxVal = 255, inThresholdType = THRESH_BINARY, inUseOtsu = false.

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError Input image must be 1-channel, UINT8 or REAL image in cvThreshold.

Complexity Level

This filter is available on Basic Complexity Level.

See Also