Herror ::dist_ellipse_contour_xld (
    Hobject Contours,
    const HTuple &Mode,
    const HTuple &MaxNumPoints,
    const HTuple &ClippingEndPoints,
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2,
    double *MinDist,
    double *MaxDist,
    double *AvgDist,
    double *SigmaDist
)
Herror ::dist_ellipse_contour_xld (
    Hobject Contours,
    const HTuple &Mode,
    const HTuple &MaxNumPoints,
    const HTuple &ClippingEndPoints,
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2,
    HTuple *MinDist,
    HTuple *MaxDist,
    HTuple *AvgDist,
    HTuple *SigmaDist
)
double HXLDCont::DistEllipseContourXld (
    const HTuple &Mode,
    const HTuple &MaxNumPoints,
    const HTuple &ClippingEndPoints,
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2,
    double *MaxDist,
    double *AvgDist,
    double *SigmaDist
) const
HTuple HXLDContArray::DistEllipseContourXld (
    const HTuple &Mode,
    const HTuple &MaxNumPoints,
    const HTuple &ClippingEndPoints,
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2,
    HTuple *MaxDist,
    HTuple *AvgDist,
    HTuple *SigmaDist
) const

Distance of contours to an ellipse.

::dist_ellipse_contour_xld determines the distance between the contours in Contours and an ellipse specified by the center (Row, Column), the orientation of the main axis Phi, the length of the larger half axis Radius1, and the length of the smaller half axis Radius2. Different measures for the distance of a contour point X = (Xi,Yi) to the ellipse are available (Mode):

'algebraic':
The distance is measured by the algebraic distance
a*Xi^2 + b*Xi*Yi + c*Yi^2 + d*Xi + e*Yi + f, where the
parameters a - f describing the ellipse are normalized in order
to obtain Radius2 as distance of the center of the
ellipse. This measure shows a 'high curvature bias': Near points of
high curvature on the ellipse (like the poles on the main axis)
the distance is smaller than near points with low curvature.

'geometric':
The distance is measured by the deviation XF1 + XF2 - 2a,
where F1,F2 are the focal points and a corresponds to Radius1.
This measure shows a 'low curvature bias': Near points of
high curvature on the ellipse (like the poles on the main axis)
the distance is larger than near points with low curvature.

'bisec':
The distance is measured by the distance between X and the
intersection of the angular bisector of the two lines through X and the 
focal points with the ellipse. This is a very good approximation of
the orthogonal distance from X to the ellipse.
The operator returns the minimum absolute distance MinDist, the maximum absolute distance MaxDist, the average absolute distance AvgDist, and the standard deviation of the absolute distances SigmaDist of all contour points.

To reduce the computational load, the computation of the distances can be restricted to a subset of the contour points: If a value other than -1 is assigned to MaxNumPoints, only up to MaxNumPoints points - uniformly distributed over the contour - are used. Due to artefacts in the pre-processing the start and end points of a contour might be faulty. Therefore, it is possible to exclude ClippingEndPoints at the beginning and at the end of a contour from the computation.


Parameters

Contours (input_object)
xld_cont(-array) -> Hobject: HXLDCont(Array)
Input contours.

Mode (input_control)
string -> HTuple.char *
Method for the determination of the distances.
Default value: 'bisec'
List of values: 'geometric', 'algebraic', 'bisec'

MaxNumPoints (input_control)
integer -> HTuple.long
Maximum number of contour points used for the computation (-1 for all points).
Default value: -1
Restriction: MaxNumPoints >= 3

ClippingEndPoints (input_control)
integer -> HTuple.long
Number of points at the beginning and the end of the contours to be ignored for the computation of distances.
Default value: 0
Restriction: ClippingEndPoints >= 0

Row (input_control)
ellipse.center.y -> HTuple.double
Row coordinate of the center of the ellipse of the ellipse.

Column (input_control)
ellipse.center.x -> HTuple.double
Column coordinate of the center of the ellipse.

Phi (input_control)
ellipse.angle.rad -> HTuple.double
Orientation of the main axis [rad].
Restriction: (Phi >= 0) && (Phi <= 6.283185307)

Radius1 (input_control)
ellipse.radius1 -> HTuple.double
Length of the larger half axis.
Restriction: Radius1 > 0

Radius2 (input_control)
ellipse.radius2 -> HTuple.double
Length of the smaller half axis.
Restriction: Radius2 >= 0

MinDist (output_control)
real(-array) -> (HTuple.) double *
Minimaler Abstand.

MaxDist (output_control)
real(-array) -> (HTuple.) double *
Maximaler Abstand.

AvgDist (output_control)
real(-array) -> (HTuple.) double *
Mittlerer Abstand.

SigmaDist (output_control)
real(-array) -> (HTuple.) double *
Standardabweichung des Abstands.


Example
read_image (Image, "caltab");
find_caltab (Image, &Caltab, "caltabBig.descr", 3, 112, 5)
reduce_domain (Image, Caltab, &ImageReduced);
edges_sub_pix (ImageReduced, &Edges, "lanser2", 0.5, 20, 40);
select_contours_xld (Edges, &EdgesClosed, "closed", 0, 2.0, 0, 0);
select_contours_xld (EdgesClosed, &EdgesMarks, "length", 20, 80, 0, 0);
fit_ellipse_contour_xld (EdgesMarks, "fitzgibbon", -1, 2, 0, 200, 3, 2.0, 
                         &Row, &Column, &Phi, &Radius1, &Radius2, &StartPhi, 
                         &EndPhi, &PointOrder);

Result

::dist_ellipse_contour_xld returns H_MSG_TRUE if all parameter values are correct. If necessary, an exception is raised.


Possible Predecessors

::fit_ellipse_contour_xld


Module

Sub-pixel operators



Copyright © 1996-2002 MVTec Software GmbH