F_VN_LaplacianFilterExp

F_VN_LaplacianFilterExp 1:

Apply a Laplacian filter to an image. (expert function)

Syntax

Definition:

FUNCTION F_VN_LaplacianFilterExp : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    ipDestImage : Reference To ITcVnImage;
    eDestDepth  : ETcVnElementType;
    nKernelSize : UDINT;
    fScale      : LREAL;
    fDelta      : LREAL;
    eBorderType : ETcVnBorderInterpolationMethod;
    hrPrev      : HRESULT;
END_VAR

F_VN_LaplacianFilterExp 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image

ipDestImage

Reference To ITcVnImage

Destination image (An appropriate destination image will be created if required.)

eDestDepth

ETcVnElementType

Destination image depth

nKernelSize

UDINT

Aperture size used to compute the second-derivative filters (1, 3, 5, ..., 31)

fScale

LREAL

Scale factor for the computed derivative values

fDelta

LREAL

Delta value that is added to the results before storing them

eBorderType

ETcVnBorderInterpolationMethod

Image border handling

hrPrev

HRESULT

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

F_VN_LaplacianFilterExp 3: Return value

HRESULT

Further information

The function F_VN_LaplacianFilterExp is the expert version of F_VN_LaplacianFilter. It contains additional parameters.

Parameter

Input image

The input image ipSrcImage may be in any available format, except for the data types SINT and DINT, which are generally not supported.

Result image

The result image ipDestImage has the same size as the input image ipSrcImage, but the pixel format is determined by the result depth eDestDepth.

Result depth

The result depth eDestDepth defines which element type the result image ipDestImage has. A larger element type can display more information.

Notice

Combination of input image and result depth

Only the same or a larger data type than that of the input image can be used as the result depth, otherwise data would be lost. For example, a UINT cannot be converted to a USINT. Furthermore, there are two restrictions, so that a UINT cannot be converted into an INT and a REAL cannot be converted into an LREAL.

Kernel size

The parameter nKernelSize defines the size of the filter kernel for the approximation of the 2nd derivative. Only odd numbers between 1 and 31 are allowed.

Scaling

The result of the Laplace operation is multiplied by the scaling factor fScale.

Delta

The constant delta fDelta is added to the result of the Scharr 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

The application of a Laplace filter with a kernel size of 3×3 looks like this, for example:

hr := F_VN_LaplacianFilterExp(
    ipSrcImage  :=  ipImageIn,
    ipDestImage :=  ipImageRes,
    eDestDepth  :=  TCVN_ET_USINT,
    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