F_VN_DetectBlobsExp

F_VN_DetectBlobsExp 1:

Detects blob-contours. Applies a threshold, a contour search and offers several options for filtering the found contours. Provides easy setup for multiple thresholds and combination of results. (expert function)
Can use available TwinCAT Job Tasks for executing parallel code regions.
Can return partial results when canceled by Watchdog.

Syntax

Definition:

FUNCTION F_VN_DetectBlobsExp : HRESULT
VAR_INPUT
    ipSrcImage     : ITcVnImage;
    ipBlobContours : Reference To ITcVnContainer;
END_VAR
VAR_IN_OUT
    stParams       : TcVnParamsBlobDetection;
    aOffset        : TcVnPoint;
END_VAR
VAR_INPUT
    hrPrev         : HRESULT;
END_VAR

F_VN_DetectBlobsExp 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image (USINT or REAL, 1 channel or 3 channel (3 channel input is expected to be RGB and internally converted to Gray))

ipBlobContours

Reference To ITcVnContainer

Returns a container which is filled with the found contours (ContainerType_Vector_Vector_TcVnPoint2_DINT; The elements of this container are single contours. Non-zero interface pointers are reused.)

hrPrev

HRESULT

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

F_VN_DetectBlobsExp 3: In/Outputs

Name

Type

Description

stParams

TcVnParamsBlobDetection

Parameters to filter the detected contours.

aOffset

TcVnPoint

Offset by which every contour point is shifted

F_VN_DetectBlobsExp 4: Return value

HRESULT

Further information

The function F_VN_DetectBlobsExp is the expert version of F_VN_DetectBlobs. It contains additional parameters.

Parameter

Input image

The input image ipSrcImage must be a 1-channel or 3-channel image of the type USINT or REAL. 3-channel images are interpreted as RGB and converted internally into grayscale images.

List of contours found (Return value)

All contours found in the input image are returned in the container ipBlobContours.

Parameters for blob detection

The parameters stParams of the structure TcVnParamsBlobDetection define which features a contour in the input image must have in order to be found and returned.

Offset (Expert)

The offset aOffset defines constant X/Y values by which all contour points are shifted. This can be helpful when contours are sought in an ROI and their positions should be referenced to the original image.

Related functions

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