F_VN_SobelFilterExp
Calculates the first, second, third, or mixed image derivatives using an extended Sobel filter. (expert function)
Syntax
Definition:
FUNCTION F_VN_SobelFilterExp : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
ipDestImage : Reference To ITcVnImage;
eDestDepth : ETcVnElementType;
nXOrder : UDINT;
nYOrder : UDINT;
nKernelSize : UDINT;
fScale : LREAL;
fDelta : LREAL;
eBorderType : ETcVnBorderInterpolationMethod;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image | |
ipDestImage |
Reference To ITcVnImage |
Destination image (An appropriate destination image will be created if required.) |
eDestDepth |
Destination image depth | |
nXOrder |
UDINT |
Order of the x-derivative (must be < nKernelSize) |
nYOrder |
UDINT |
Order of the y-derivative (must be < nKernelSize) |
nKernelSize |
UDINT |
Size of the extended Sobel kernel (3, 5, 7, ..., 31) |
fScale |
LREAL |
Scale factor for the computed derivative values |
fDelta |
LREAL |
Delta value that is added to the results prior to storing them in dest |
eBorderType |
Image border handling | |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_SobelFilterExp
is the expert version of F_VN_SobelFilter. It contains additional parameters.
Parameter
Original image
The original image ipSrcImage
can have any format.
Result image
The result image ipDestImage
returns the filter result and has the same format as the original image ipSrcImage
.
Result depth
The result depth eDestDepth
defines which element type the result image ipDestImage
has. A larger element type can display more information.
Derivative order
The derivative orders nXOrder
and nYOrder
define which derivative in the X and Y direction is to be used to create the filter.
Kernel size
The size nKernelSize of the Sobel kernel determines how large the area is that influences the result value of a pixel.
Scaling
The result of the Sobel operation is multiplied by the scaling factor fScale
.
Delta
The constant delta fDelta
is added to the result of the Sobel operation after scaling with fScale
.
Border extrapolation
The method of border extrapolation eBorderType
defines how non-existent pixels are extrapolated beyond the image border in order to calculate the filter values at the image borders. For further details, see ETcVnBorderInterpolationMethod.
Application
hr := F_VN_SobelFilterExp(
ipSrcImage := ipImageIn,
ipDestImage := ipImageRes,
eDestDepth := TCVN_ET_USINT,
nXOrder := 1,
nYOrder := 1,
nKernelSize := 3,
fScale := 1,
fDelta := 0,
eBorderType := TCVN_BIM_DEFAULT,
hrPrev := hr,
);
Samples
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 |