F_VN_DrawContours
Draws a single point set or multiple point sets that are interpreted as contours.
Syntax
Definition:
FUNCTION F_VN_DrawContours : HRESULT
VAR_INPUT
ipContours : ITcVnContainer;
nContourIndex : DINT;
ipDestImage : ITcVnImage;
END_VAR
VAR_IN_OUT
aColor : TcVnVector4_LREAL;
END_VAR
VAR_INPUT
nThickness : DINT;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipContours |
Single contour (ContainerType_Vector_TcVnPoint2_DINT) or multiple contours (ContainerType_Vector_Vector_TcVnPoint2_DINT) | |
nContourIndex |
DINT |
Index of a specific contour to be drawn (if negative, all contours within the container are drawn) |
ipDestImage |
Destination image | |
nThickness |
DINT |
Line thickness (if negative, the contours are filled) |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
Further information
The function F_VN_DrawContours
draws contours in the destination image. A contour is described based on a set of points that are stored in a container. Please note that only integer contour points can be drawn, so that the container must be of type ContainerType_Vector_TcVnPoint2_DINT. If the points are described using floating point numbers, F_VN_ConvertContainerType can be used to convert the points.
In addition to a container with one contour, a container with several contours can be transferred to the function. This is of type ContainerType_Vector_Vector_TcVnPoint2_DINT. The input variable nContourIndex indicates which contour is to be drawn. If all contours are to be drawn, nContourIndex must be set to a negative value. It is more efficient to draw an entire container of contours at once (set nContourIndex to a negative value) than to draw them one after the other by repeatedly calling the function within a loop.
Expert parameters
The expert version F_VN_DrawContoursExp contains additional parameters.
Application
The painting of all contours in a contour list ipContours
with a red line of 5 px in thickness looks like this, for example:
hr := F_VN_DrawContours(
ipContours := ipContours,
nContourIndex := -1,
ipDestImage := ipImageRes,
aColor := aColorRed,
nThickness := 5,
hrPrev := hr
);
Typical functions that return contours of type ContainerType_Vector_Vector_TcVnPoint2_DINT
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 |