F_VN_CreateStructuringElement
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
Inputs
|
Name |
Type |
Description |
|---|---|---|
|
ipStructuringElement |
Reference To ITcVnImage |
Returns the created structuring element (Non-zero interface pointers are reused.) |
|
eShape |
Shape of the structuring element (rectangle, cross, or ellipse) | |
|
nWidth |
UDINT |
Width |
|
nHeight |
UDINT |
Height |
|
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function creates a structure element that can be used for morphological operations with F_VN_MorphologicalOperator.
Parameter
Structure element
The structure element created, ipStructuringElement, is returned as ITcVnImage by representing the structure element with pixels with the value 1.
Shape
The shape eShape of the structure element is defined by the enum ETcVnStructuringElementShape. The following shapes are available:
TCVN_SES_RECTANGLE | TCVN_SES_CROSS | TCVN_SES_ELLIPSE |
|
|
|
![]() | As the pixel values of the structure element are 1, they were scaled up here for a better display. |
Size
The size of the structure element is defined by the width nWidth and height nHeight of the image ipStructuringElement to be created.
Application
The creation of a square structure element of the size 9 looks like this, for example:
hr := F_VN_CreateStructuringElement(
ipStructuringElement := ipElement,
eShape := TCVN_SES_RECTANGLE,
nWidth := 9,
nHeight := 9,
hrPrev := hr
);Required License
TC3 Vision Base
Return value


