F_VN_AdjustSearchWindowOrientationToLinearEdge

F_VN_AdjustSearchWindowOrientationToLinearEdge 1:

Adjust the search window to be orthogonal to a linear edge. Might be helpful before calling edge localization and distance measurement functions that rely on the search window.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

FUNCTION F_VN_AdjustSearchWindowOrientationToLinearEdge : HRESULT
VAR_INPUT
    ipSrcImage     : ITcVnImage;
END_VAR
VAR_IN_OUT
    aStartPoint    : TcVnPoint2_REAL;
    aEndPoint      : TcVnPoint2_REAL;
END_VAR
VAR_INPUT
    eEdgeDirection : ETcVnEdgeDirection;
    fMinStrength   : REAL;
    nMaxThickness  : UDINT;
    nSearchLines   : UDINT;
    hrPrev         : HRESULT;
END_VAR

F_VN_AdjustSearchWindowOrientationToLinearEdge 2: Inputs

Name

Type

Description

ipSrcImage

ITcVnImage

Source image

eEdgeDirection

ETcVnEdgeDirection

Specification of the edge direction to search for

fMinStrength

REAL

Specification of the minimum strength (intensity difference) of the edge to search for

nMaxThickness

UDINT

Specification of the maximum thickness of the edge to search for, which means fMinStrength must be reached within nMaxThickness pixels

nSearchLines

UDINT

Width of the search window, i.e. the number of search lines (3, 5, 7, ...), centered around the line specified by aStartPoint and aEndPoint

hrPrev

HRESULT

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

F_VN_AdjustSearchWindowOrientationToLinearEdge 3: In/Outputs

Name

Type

Description

aStartPoint

TcVnPoint2_REAL

Position from which to start the search process (in the direction of aEndPoint), which is not changed

aEndPoint

TcVnPoint2_REAL

Position where the search process ends, which is adjusted by this function

F_VN_AdjustSearchWindowOrientationToLinearEdge 4: Return value

HRESULT

Further information

The function F_VN_AdjustSearchWindowOrientationToLinearEdge rotates the search field for measurement functions in such a way that it lies orthogonal to a linear edge.

Parameter

Input image

The input image ipSrcImage must contain an edge in accordance with the parameters for edge detection.

Search field (Return value)

The search field to be adjusted is transferred as a reference so that it can be adjusted. The search field consists of the central search line, which consists of the start point aStartPoint and end point aEndPoint, as well as the number of search lines nSearchLines.

Following the function call, aStartPoint and aEndPoint contain the adjusted central search line. This is now orthogonal to the linear edge on the input image ipSrcImage.

Parameters for edge localization

The parameters eEdgeDirection, fMinStrength and nMaxThickness determine the search features for the linear edge in the input image ipSrcImage. These work analogously to the edge localization in F_VN_LocateEdge.

Required License

TC3 Vision Metrology 2D

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