F_VN_CustomFilterExp

F_VN_CustomFilterExp 1:

Apply a custom filter to the image. (expert function)

Syntax

Definition:

FUNCTION F_VN_CustomFilterExp : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    ipDestImage : Reference To ITcVnImage;
    eDestDepth  : ETcVnElementType;
END_VAR
VAR_IN_OUT
    stKernel    : TcVnMatrix;
    aAnchor     : TcVnPoint;
END_VAR
VAR_INPUT
    fDelta      : LREAL;
    eBorderType : ETcVnBorderInterpolationMethod;
    hrPrev      : HRESULT;
END_VAR

F_VN_CustomFilterExp 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

fDelta

LREAL

Value added to each pixel after filtering

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_CustomFilterExp 3: In/Outputs

Name

Type

Description

stKernel

TcVnMatrix

Custom filter kernel with values of type REAL or LREAL

aAnchor

TcVnPoint

Anchor point of the kernel

F_VN_CustomFilterExp 4: Return value

HRESULT

Further information

The function F_VN_CustomFilterExp is the expert version of F_VN_CustomFilter. It contains additional parameters.

Parameter

Input image

The input image ipSrcImage may have any available format.

Result image

The result image ipDestImage has the same format as the input 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.

Filter kernel

The user-defined filter kernel stKernel is transferred as a matrix. Permitted element types of the matrix are TCVN_ET_REAL and TCVN_ET_LREAL. A corresponding matrix of the type TcVnMatrix can be created with the aid of the function F_VN_InitMatrixStruct.

Anchor point

The anchor point aAnchor defines which point of the filter kernel is moved over each pixel of the input image ipSrcImage.

Delta

The constant delta fDelta is added to the result of the filter operation.

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_CustomFilterExp(
    ipSrcImage  :=  ipImageIn,
    ipDestImage :=  ipImageRes,
    eDestDepth  :=  TCVN_ET_USINT,
    stKernel    :=  stKernelMatrix,
    aAnchor     :=  aAnchorPoint,
    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