F_VN_CannyEdgeDetectionExp

F_VN_CannyEdgeDetectionExp 1:

Find edges using the Canny edge detection algorithm. (expert function)
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_CannyEdgeDetectionExp : HRESULT
VAR_INPUT
    ipSrcImage     : ITcVnImage;
    ipDestImage    : Reference To ITcVnImage;
    fThresholdLow  : LREAL;
    fThresholdHigh : LREAL;
    nApertureSize  : UDINT;
    bL2Gradient    : BOOL;
    hrPrev         : HRESULT;
END_VAR

F_VN_CannyEdgeDetectionExp 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (elements of type USINT)

ipDestImage

Reference To ITcVnImage

Destination image (elements of type USINT. An appropriate destination image will be created if required.)

fThresholdLow

LREAL

Low threshold

fThresholdHigh

LREAL

High threshold

nApertureSize

UDINT

Aperture size for the Sobel operator (3, 5, 7)

bL2Gradient

BOOL

If true, the more accurate (and slower) L2 norm is used instead of the L1 norm

hrPrev

HRESULT

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

F_VN_CannyEdgeDetectionExp 3: Return value

HRESULT

Weiterführende Informationen

Diese Funktion ist die Expert-Variante von F_VN_CannyEdgeDetection. Sie enthält erweiterte Parametriermöglichkeiten.

Parameter

Folgende Parameter stehen in dieser Expert-Variante zusätzlich zur Verfügung:

Blendengröße

Für nApertureSize sind nur ungerade Werte ab 3 valide.

L1-/L2-Norm

Für die Berechnung der Gradienten stehen zwei Normen zur Verfügung. Die L1-Norm ist schneller. Die L2-Norm ist hingegen genauer.

F_VN_CannyEdgeDetectionExp 4:

Setzen Sie den Parameter bL2Gradient auf FALSE, um die L1-Norm zu verwenden, und auf TRUE, um die L2-Norm zu verwenden.

Anwendung

Eine Anwendung dieser Funktion kann z.B. wie folgt aussehen:

hr := F_VN_CannyEdgeDetectionExp(
    ipSrcImage      :=  ipImageIn,
    ipDestImage     :=  ipImageWork,
    fThresholdLow   :=  0,
    fThresholdHigh  :=  200,
    nApertureSize   :=  5,
    bL2Gradient     :=  TRUE,

    hr
);

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