F_VN_MorphologicalOperator
Apply a morphological operator.
Syntax
Definition:
FUNCTION F_VN_MorphologicalOperator : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
ipDestImage : Reference To ITcVnImage;
eOperator : ETcVnMorphologicalOperator;
ipStructuringElement : ITcVnImage;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image (only 1 channel supported for reconstruction operators) | |
ipDestImage |
Reference To ITcVnImage |
Destination image (An appropriate destination image will be created if required.) |
eOperator |
Operator type | |
ipStructuringElement |
Structuring element to be applied (Typically created via F_VN_CreateStructuringElement.) | |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_MorphologicalOperator
applies a morphological operator to the input image.
Parameter
Original image
The Reconstruction operators can only be applied to a 1-channel image, the other operators have no special requirements for the original image ipSrcImage
.
Result image
The modified image is returned in the result image ipDestImage
.
Morphological operator
The parameter eOperator
defines which morphological operator is applied to the original image ipSrcImage
. All operators in the enum ETcVnMorphologicalOperator are available.
Structure element
The structure element ipStructuringElement
is the element that specifies the filter area of the morphological operator. It can be created with the help of the function F_VN_CreateStructuringElement.
Application
The application of an Opening operator with a rectangular filter area of the size 3×3
looks like this, for example:
VAR
ipElement : ITcVnImage;
END_VAR
hr := F_VN_CreateStructuringElement(ipElement, TCVN_SES_RECTANGLE, 3, 3, hr);
hr := F_VN_MorphologicalOperator(
ipSrcImage := ipImageIn,
ipDestImage := ipImageRes,
eOperator := TCVN_MO_OPENING,
ipStructuringElement := ipElement,
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 |