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

Weiterführende Informationen

Die Funktion F_VN_CustomFilterExp ist die Expert-Variante von F_VN_CustomFilter. Sie enthält zusätzliche Parameter.

Parameter

Eingangsbild

Das Eingangsbild ipSrcImage darf jedes verfügbare Format haben.

Ergebnisbild

Das Ergebnisbild ipDestImage hat das gleiche Format wie das Eingangsbild ipSrcImage.

Ergebnistiefe

Die Ergebnistiefe eDestDepth definiert, welchen Element-Typ das Ergebnisbild ipDestImage hat. Ein größerer Element-Typ kann mehr Informationen darstellen.

Filter-Kernel

Der benutzerdefinierte Filter-Kernel stKernel wird als Matrix übergeben. Erlaubte Element-Typen der Matrix sind TCVN_ET_REAL und TCVN_ET_LREAL. Eine entsprechende Matrix vom Typ TcVnMatrix kann mit Hilfe der Funktion F_VN_InitMatrixStruct erstellt werden.

Ankerpunkt

Der Ankerpunkt aAnchor definiert, welcher Punkt des Filter-Kernels über jedes Pixel des Eingangsbildes ipSrcImage bewegt wird.

Delta

Das konstante Delta fDelta wird auf das Ergebnis der Filter-Operation addiert.

Rand-Extrapolation

Die Art der Rand-Extrapolation eBorderType definiert, wie nichtexistente Pixel über die Bildgrenze hinaus extrapoliert werden, um die Filterwerte an den Bildgrenzen auszurechnen. Für weitere Details siehe ETcVnBorderInterpolationMethod.

Anwendung

hr := F_VN_CustomFilterExp(
    ipSrcImage  :=  ipImageIn,
    ipDestImage :=  ipImageRes,
    eDestDepth  :=  TCVN_ET_USINT,
    stKernel    :=  stKernelMatrix,
    aAnchor     :=  aAnchorPoint,
    fDelta      :=  0,
    eBorderType :=  TCVN_BIM_DEFAULT,

    hrPrev      :=  hr
);

Beispiele

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1. 4024.44 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision