F_VN_BilateralFilterExp

F_VN_BilateralFilterExp 1:

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

Syntax

Definition:

FUNCTION F_VN_BilateralFilterExp : HRESULT
VAR_INPUT
    ipSrcImage  : ITcVnImage;
    ipDestImage : Reference To ITcVnImage;
    nDiameter   : DINT;
    fSigmaColor : LREAL;
    fSigmaSpace : LREAL;
    eBorderType : ETcVnBorderInterpolationMethod;
    hrPrev      : HRESULT;
END_VAR

F_VN_BilateralFilterExp 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image

ipDestImage

Reference To ITcVnImage

Destination image (Must be different from ipSrcImage! An appropriate destination image will be created if required.)

nDiameter

DINT

Diameter of the pixel neighborhood used for filtering (e.g. 5, 7, 9). If <= 0, it is automatically chosen dependend on fSigmaSpace.

fSigmaColor

LREAL

Sigma used for color space filtering (> 0). A larger value means that farther colors are mixed together.

fSigmaSpace

LREAL

Sigma used for coordinate space filtering (> 0). A larger value means that farther pixels can influence each other.

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

HRESULT

Further information

The function F_VN_BilateralFilterExp is the expert version of F_VN_BilateralFilter. It contains additional parameters.

Parameter

Original image

The original image ipSrcImage must be of the element type TCVN_ET_USINT or a floating point type and have 1 or 3 channels.

Result image

The result image ipDestImage must be a different interface pointer to the original image ipSrcImage!

Filter diameter

The filter diameter nDiameter determines the size of a filter area. An odd number is expected. If nDiameter = 0, then the filter diameter is automatically calculated on the basis of fSigmaSpace.

Color area

This value may not be 0.

Room area

This value may not be 0.

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

An application of this function can look like this, for example:

hr := F_VN_BilateralFilterExp(
    ipSrcImage      :=  ipImage,
    ipDestImage     :=  ipImageRes,
    nDiameter       :=  nDiameter,
    fSigmaColor     :=  fSigmaColor,
    fSigmaSpace     :=  fSigmaSpace,
    eBorderType     :=  eBorderType,
    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