F_VN_AdaptiveThreshold
Apply an adaptive threshold to a gray level image.
Can return partial results when canceled by Watchdog.
Syntax
Definition:
FUNCTION F_VN_AdaptiveThreshold : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
ipDestImage : Reference To ITcVnImage;
fMaxValue : LREAL;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image (1 channel, elements of type USINT) | |
ipDestImage |
Reference To ITcVnImage |
Destination image (An appropriate destination image will be created if required.) |
fMaxValue |
LREAL |
Value assigned to pixels for which the threshold condition is true |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_AdaptiveThreshold
applies an adaptive threshold to the input image.
Parameter
Input image
The input image ipSrcImage
must be a 1-channel grayscale image with a bit depth of 8 bits (USINT
).
Result image
The binary result image ipDestImage
has the same format as the input image. The pixels have either the value 0
or the target value fMaxValue
.
Target value
The target value fMaxValue
defines which value should be given to the pixels that fulfil the threshold criterion. If the result image is to consist only of black and white pixels, then the maximum value of the element type of the input image must be set here. This corresponds to (2^d)-1
, where d represents the bit depth of the element type; e.g. (2^8)-1=255
with 8-bit images.
Expert parameters
The expert version F_VN_AdaptiveThresholdExp contains additional parameters.
Application
hr := F_VN_AdaptiveThreshold(
ipSrcImage := ipImageIn,
ipDestImage := ipImageRes,
fMaxValue := 255, // max value of 8-bit image: (2^8)-1=255
hrPrev := hr
);
Related functions
- F_VN_DoubleThreshold for binary segmentation on the basis of double threshold values using morphological reconstruction
- F_VN_Threshold for binary segmentation on the basis of a threshold value
- F_VN_AdaptiveThreshold for binary, adaptive segmentation
- F_VN_CheckColorRange for binary segmentation on the basis of a color spectrum
- F_VN_ReferenceColorSimilarity for binary segmentation on the basis of a color model
Required License
TC3 Vision Base
System Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT V3.1.4024.54 or later | PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |