F_VN_GaussianFilterExp

F_VN_GaussianFilterExp 1:

Apply a Gaussian filter to smooth the image. (expert function)
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_GaussianFilterExp : HRESULT
VAR_INPUT
    ipSrcImage    : ITcVnImage;
    ipDestImage   : Reference To ITcVnImage;
    nFilterWidth  : UDINT;
    nFilterHeight : UDINT;
    fSigmaX       : LREAL;
    fSigmaY       : LREAL;
    eBorderType   : ETcVnBorderInterpolationMethod;
    hrPrev        : HRESULT;
END_VAR

F_VN_GaussianFilterExp 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image

ipDestImage

Reference To ITcVnImage

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

nFilterWidth

UDINT

Filter width in pixels (1, 3, 5, 7, ...)

nFilterHeight

UDINT

Filter height in pixels (1, 3, 5, 7, ...)

fSigmaX

LREAL

Gaussian kernel standard deviation in X direction (>= 0, automatically chosen if 0)

fSigmaY

LREAL

Gaussian kernel standard deviation in Y direction (>= 0, automatically chosen if 0)

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_GaussianFilterExp 3: Return value

HRESULT

Further information

The function F_VN_GaussianFilterExp is the expert version of F_VN_GaussianFilter. It contains additional parameters.

Parameter

Input image

The input image ipSrcImage may have any available format.

Result image

The result image ipDestImage is given the same format as the input image ipSrcImage.

Filter size

The size of the Gauss filter is described in the X direction by nFilterWidth and in the Y direction by nFilterHeight. The size specifications must be odd numbers, as there must always be a central pixel.

Standard deviation

The standard deviation in the X direction fSigmaX and in the Y direction fSigmaY defines not only the filter size but also the shape of the Gauss curve used in the filter.

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_GaussianFilterExp(
    ipSrcImage      :=  ipImageIn,
    ipDestImage     :=  ipImageRes,
    nFilterWidth    :=  3,
    nFilterHeight   :=  3,
    fSigmaX         :=  5,
    fSigmaY         :=  5,
    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