LocateAxisAlignedEdges
Locate the position of multiple occurring edges inside a specified search window. The edges inside the search window must be straight and aligned to one of the image axes. They are located by interpolating the peaks of the first Gaussian derivative of the pixel intensities.
Syntax
Definition:
HRESULT LocateAxisAlignedEdges(
HRESULT hrPrev,
ITcVnImage* ipSrcImage,
ITcVnContainer*& ipEdgePoints,
TcVnPoint2_DINT& aStartPoint,
TcVnPoint2_DINT& aEndPoint,
ULONG nSearchWindowHeight,
ULONG nKernelSize,
ULONG nNumEdges,
ETcVnEdgeSelection eEdgeSelection,
float fMinStrength,
float& fAvgStrength,
float fSigma = 0,
ITcVnContainer** pipEdgeStrengths = nullptr,
ITcVnImage** pipDerivative = nullptr
)Parameters
|
Name |
Type |
Default |
Description |
|---|---|---|---|
|
hrPrev |
|
HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.) | |
|
ipSrcImage |
|
Source image (1 channel of type ET_USINT, ET_UINT, ET_INT or ET_REAL) | |
|
ipEdgePoints |
|
Returns the detected edge points (ContainerType_Vector_TcVnPoint2_REAL) | |
|
aStartPoint |
|
Position from which to start the search process (in the direction of aEndPoint) | |
|
aEndPoint |
|
Position where the search process ends. As the search direction must be parallel to one of the images axes, aEndPoint must have the same x- or y-coordinate as aStartPoint. | |
|
nSearchWindowHeight |
ULONG |
|
Specifies the height of the search window, i.e. the number of rows for horizontal or columns for vertical search directions, centered around the line between aStartPoint and aEndPoint. Depending on the orientation, the rows or columns inside that window are averaged and the edges are located on that averaged row or column. Therefore it is important that the edges inside the defined search window are straight and perpendicular to the search direction. |
|
nKernelSize |
ULONG |
|
The size of the Gaussian derivative kernel, that is used to locate the edges. The size must be odd and >= 3 (5 or 7 are usually a good choice for sharp edges). |
|
nNumEdges |
ULONG |
|
The (maximum) number of edges to search for |
|
eEdgeSelection |
|
Selects the edge directions to search for | |
|
fMinStrength |
float |
|
Specification of the minimum strength (absolute peak height of the Gaussian derivative of the pixel intensities) of the edge to search for. This value depends on the edge sharpness and nKernelSize, but is generally smaller or equal to the difference of the pixel intensities of the edge. Sharp edges have a higher peak than unsharp ones. Initially, you might choose a relatively small value (e.g. 30) and then increase it depending on the fAvgStrength and ipEdgeStrengths output. |
|
fAvgStrength |
float& |
|
Returns the average strength of the detected edges |
|
fSigma |
float |
0 |
The sigma parameter for the Gaussian derivative function. If set to 0, a suitable value is automatically chosen depending on nKernelSize. For manually defined sigma, the value should always be chosen depending on nKernelSize (e.g. fSigma = (nKernelSize - 1) / factor, with factor in a range of 4 to 8). |
|
pipEdgeStrengths |
nullptr |
Returns the individual edge strengths, where dark to light edge strengths are positive and light to dark edge strengths are negative (optional, set to 0 if not required; ContainerType_Vector_REAL). | |
|
pipDerivative |
nullptr |
Returns the Gaussian derivative of the pixel intensities on the search line between aStartPoint and aEndPoint as a single image row, where aStartPoint would be on the left and aEndPoint on the right (optional, set to 0 if not required; 1 channel, ET_REAL). |
Required License
TC3 Vision Metrology 2D
System Requirements
|
Development environment |
Target platform |
PLC libraries to include |
|---|---|---|
|
TwinCAT V3.1.4026 or later |
PC or CX (x64) with min. PL50, e.g. Intel 4-core Atom CPU |
Tc3_Vision |