F_VN_CannyEdgeDetectionExp
Find edges using the Canny edge detection algorithm. (expert function)
Can use available TwinCAT Job Tasks for executing parallel code regions.
Syntax
Definition:
FUNCTION F_VN_CannyEdgeDetectionExp : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
ipDestImage : Reference To ITcVnImage;
fThresholdLow : LREAL;
fThresholdHigh : LREAL;
nApertureSize : UDINT;
bL2Gradient : BOOL;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image (elements of type USINT) | |
ipDestImage |
Reference To ITcVnImage |
Destination image (elements of type USINT. An appropriate destination image will be created if required.) |
fThresholdLow |
LREAL |
Low threshold |
fThresholdHigh |
LREAL |
High threshold |
nApertureSize |
UDINT |
Aperture size for the Sobel operator (3, 5, 7) |
bL2Gradient |
BOOL |
If true, the more accurate (and slower) L2 norm is used instead of the L1 norm |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
This function is the expert version of F_VN_CannyEdgeDetection. It contains advanced parameterization options.
Parameter
The following parameters are additionally available in this expert version:
Aperture size
Only odd values of 3
or more are valid for nApertureSize
.
L1/L2 standard
Two standards are available for the calculation of the gradients. The L1 standard is faster. The L2 standard, conversely, is more accurate.
Set the parameter bL2Gradient
to FALSE
to use the L1 standard and to TRUE
to use the L2 standard.
Application
An application of this function can look like this, for example:
hr := F_VN_CannyEdgeDetectionExp(
ipSrcImage := ipImageIn,
ipDestImage := ipImageWork,
fThresholdLow := 0,
fThresholdHigh := 200,
nApertureSize := 5,
bL2Gradient := TRUE,
hr
);
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 |