F_VN_CreateStructuringElement

F_VN_CreateStructuringElement 1:

Creates a structuring element for the usage with morphological operators and allocate an appropriate data buffer. The initial reference count is set to one if a new image interface is created and kept, otherwise.

Syntax

Definition:

FUNCTION F_VN_CreateStructuringElement : HRESULT
VAR_INPUT
    ipStructuringElement : Reference To ITcVnImage;
    eShape               : ETcVnStructuringElementShape;
    nWidth               : UDINT;
    nHeight              : UDINT;
    hrPrev               : HRESULT;
END_VAR

F_VN_CreateStructuringElement 2: Inputs

Name

Type

Description

ipStructuringElement

Reference To ITcVnImage

Returns the created structuring element (Non-zero interface pointers are reused.)

eShape

ETcVnStructuringElementShape

Shape of the structuring element (rectangle, cross, or ellipse)

nWidth

UDINT

Width

nHeight

UDINT

Height

hrPrev

HRESULT

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

F_VN_CreateStructuringElement 3: Return value

HRESULT

Weiterführende Informationen

Die Funktion erstellt ein Struktur-Element, welches für morphologische Operationen mit F_VN_MorphologicalOperator genutzt werden kann.

Parameter

Struktur-Element

Das erstellte Struktur-Element ipStructuringElement wird als ITcVnImage zurückgegeben, in dem das Struktur-Element durch Pixel mit dem Wert 1 dargestellt wird.

Form

Die Form eShape des Struktur-Elements wird durch das Enum ETcVnStructuringElementShape festgelegt. Folgende Formen sind verfügbar:

TCVN_SES_RECTANGLE

TCVN_SES_CROSS

TCVN_SES_ELLIPSE

F_VN_CreateStructuringElement 4:

F_VN_CreateStructuringElement 5:

F_VN_CreateStructuringElement 6:

F_VN_CreateStructuringElement 7:

Da die Pixel-Werte des Struktur-Elements 1 sind, wurden sie hier für eine bessere Anzeige hochskaliert.

Größe

Die Größe des Struktur-Elements wird durch die Breite nWidth und Höhe nHeight des zu erstellenden Bildes ipStructuringElement definiert.

Anwendung

Die Erstellung eines quadratischen Struktur-Elements der Größe 9 sieht z. B. wie folgt aus:

hr := F_VN_CreateStructuringElement(
    ipStructuringElement    :=  ipElement,
    eShape                  :=  TCVN_SES_RECTANGLE,
    nWidth                  :=  9,
    nHeight                 :=  9,
    hrPrev                  :=  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