F_VN_MeasureMinEdgeDistance
Measure the minimum distance within the specified search window between 2 edges, using an interpolation method.
Can use available TwinCAT Job Tasks for executing parallel code regions.
Can return partial results when canceled by Watchdog.
Syntax
Definition:
FUNCTION F_VN_MeasureMinEdgeDistance : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
END_VAR
VAR_IN_OUT
fMinDistance : REAL;
aStartPoint : TcVnPoint2_REAL;
aEndPoint : TcVnPoint2_REAL;
END_VAR
VAR_INPUT
eEdgeDirection : ETcVnEdgeDirection;
fMinStrength : REAL;
nSearchLines : UDINT;
hrPrev : HRESULT;
END_VAR
Inputs
Name |
Type |
Description |
---|---|---|
ipSrcImage |
Source image (1 channel) | |
eEdgeDirection |
Specification of the edge direction from aStartPoint to aEndPoint to search for | |
fMinStrength |
REAL |
Specification of the minimum strength (intensity difference) of the edge to search for |
nSearchLines |
UDINT |
Width of the search window, i.e. the number of search lines (1, 3, 5, 7, ...), centered around the line specified by aStartPoint and aEndPoint |
hrPrev |
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) |
In/Outputs
Name |
Type |
Description |
---|---|---|
fMinDistance |
REAL |
Returns the minimum distance between the detected edges |
aStartPoint |
Position from which to start the search process (in the direction of aEndPoint) | |
aEndPoint |
Position where the search process ends |
Further information
The F_VN_MeasureMinEdgeDistance
function localizes two linear edges and measures the minimum distance between them.
Parameter
Input image
The ipSrcImage
input image must be a 1-channel grayscale image.
Minimum distance (Return value)
The fMinDistance
parameter returns the minimum distance between the two localized edges.
The search window
First, a search window has to be defined to determine where and in which direction to search for an edge. This is done using the aStartPoint
, aEndPoint
and nSearchLines
parameters. The search window results from the search line from aStartPoint
to aEndPoint
and parallel to it (nSearchLines
- 1) / 2 search lines in each direction, each with 1 pixel distance. Thus nSearchLines
defines the number of search lines and must always have an odd value.

Parameters for edge localization
The remaining parameters are explained in detail in the chapter Edge localization.
Expert parameters
The F_VN_MeasureMinEdgeDistanceExp expert version contains additional parameters.
Application
The measurement of an edge distance looks like this, for example:
hr := F_VN_MeasureMinEdgeDistance(
ipSrcImage := ipImageIn,
fMinDistance := fMinDistance,
aStartPoint := aStartPoint,
aEndPoint := aEndPoint,
eEdgeDirection := TCVN_ED_LIGHT_TO_DARK,
fMinStrength := fMinStrength,
nSearchLines := nSearchLines,
hrPrev := hr);
Related functions
- ClosestPointsBF for calculating the closest points in two point clouds
- MeasureAngleBetweenEdges for measuring the angle between two edges
- MeasureEdgeDistance for measuring the average distance between two edges
- MeasureMinEdgeDistance for measuring the minimum distance between two edges
Required License
TC3 Vision Metrology 2D