F_VN_MeasureEdgeDistance
Measure the distance between 2 parallel 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_MeasureEdgeDistance : HRESULT
VAR_INPUT
ipSrcImage : ITcVnImage;
END_VAR
VAR_IN_OUT
fAvgDistance : 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 |
---|---|---|
fAvgDistance |
REAL |
Returns the average 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 |
Weiterführende Informationen
Die Funktion F_VN_MeasureEdgeDistance
lokalisiert zwei lineare Kanten und misst den durchschnittlichen Abstand zwischen ihnen.
Parameter
Eingangsbild
Das Eingangsbild ipSrcImage
muss ein 1-kanaliges Grauwertbild sein.
Minimaler Abstand (Rückgabewert)
Der Parameter fAvgDistance
gibt des minimalen Abstand der beiden lokalisierten Kanten zurück.
Parameter zur Kantenlokalisierung
Die restlichen Parameter sind ausführlich im Kapitel Kantenlokalisierung erklärt.
Expert-Parameter
Die Expert-Variante F_VN_MeasureEdgeDistanceExp enthält zusätzliche Parameter.
Anwendung
Die Vermessung einer Kantendistanz sieht z. B. so aus:
hr := F_VN_MeasureEdgeDistance(
ipSrcImage := ipImageIn,
fAvgDistance := fDistance
aStartPoint := aStartPoint,
aEndPoint := aEndPoint,
eEdgeDirection := TCVN_ED_LIGHT_TO_DARK,
fMinStrength := fMinStrength,
nSearchLines := nSearchLines,
hrPrev := hr
);
Verwandte Funktionen
- ClosestPointsBF zur Berechnung der nächstgelegenen Punkte zweier Punktewolken
- MeasureAngleBetweenEdges zur Vermessung des Winkels zwischen zwei Kanten
- MeasureEdgeDistance zur Vermessung des durchschnittlichen Abstands zweier Kanten
- MeasureMinEdgeDistance zur Vermessung des minimalen Abstands zweier Kanten
Required License
TC3 Vision Metrology 2D
System Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT V3.1.4024.59 or later | PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU | Tc3_Vision |