ClassesClassesClassesClasses | | | | Operators

dist_ellipse_contour_xlddist_ellipse_contour_xldDistEllipseContourXlddist_ellipse_contour_xldDistEllipseContourXldDistEllipseContourXld (Operator)

Name

dist_ellipse_contour_xlddist_ellipse_contour_xldDistEllipseContourXlddist_ellipse_contour_xldDistEllipseContourXldDistEllipseContourXld — Compute the distance of contours to an ellipse.

Signature

dist_ellipse_contour_xld(Contours : : Mode, MaxNumPoints, ClippingEndPoints, Row, Column, Phi, Radius1, Radius2 : MinDist, MaxDist, AvgDist, SigmaDist)

Herror dist_ellipse_contour_xld(const Hobject Contours, const char* Mode, const Hlong MaxNumPoints, const Hlong ClippingEndPoints, double Row, double Column, double Phi, double Radius1, double Radius2, double* MinDist, double* MaxDist, double* AvgDist, double* SigmaDist)

Herror T_dist_ellipse_contour_xld(const 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)

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

void DistEllipseContourXld(const 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)

void HXLDCont::DistEllipseContourXld(const HString& Mode, Hlong MaxNumPoints, Hlong ClippingEndPoints, double Row, double Column, double Phi, double Radius1, double Radius2, HTuple* MinDist, HTuple* MaxDist, HTuple* AvgDist, HTuple* SigmaDist) const

void HXLDCont::DistEllipseContourXld(const HString& Mode, Hlong MaxNumPoints, Hlong ClippingEndPoints, double Row, double Column, double Phi, double Radius1, double Radius2, double* MinDist, double* MaxDist, double* AvgDist, double* SigmaDist) const

void HXLDCont::DistEllipseContourXld(const char* Mode, Hlong MaxNumPoints, Hlong ClippingEndPoints, double Row, double Column, double Phi, double Radius1, double Radius2, double* MinDist, double* MaxDist, double* AvgDist, double* SigmaDist) const

void HOperatorSetX.DistEllipseContourXld(
[in] IHUntypedObjectX* Contours, [in] VARIANT Mode, [in] VARIANT MaxNumPoints, [in] VARIANT ClippingEndPoints, [in] VARIANT Row, [in] VARIANT Column, [in] VARIANT Phi, [in] VARIANT Radius1, [in] VARIANT Radius2, [out] VARIANT* MinDist, [out] VARIANT* MaxDist, [out] VARIANT* AvgDist, [out] VARIANT* SigmaDist)

VARIANT HXLDContX.DistEllipseContourXld(
[in] BSTR Mode, [in] Hlong MaxNumPoints, [in] Hlong ClippingEndPoints, [in] double Row, [in] double Column, [in] double Phi, [in] double Radius1, [in] double Radius2, [out] VARIANT* MaxDist, [out] VARIANT* AvgDist, [out] VARIANT* SigmaDist)

static void HOperatorSet.DistEllipseContourXld(HObject contours, HTuple mode, HTuple maxNumPoints, HTuple clippingEndPoints, HTuple row, HTuple column, HTuple phi, HTuple radius1, HTuple radius2, out HTuple minDist, out HTuple maxDist, out HTuple avgDist, out HTuple sigmaDist)

void HXLDCont.DistEllipseContourXld(string mode, int maxNumPoints, int clippingEndPoints, double row, double column, double phi, double radius1, double radius2, out HTuple minDist, out HTuple maxDist, out HTuple avgDist, out HTuple sigmaDist)

void HXLDCont.DistEllipseContourXld(string mode, int maxNumPoints, int clippingEndPoints, double row, double column, double phi, double radius1, double radius2, out double minDist, out double maxDist, out double avgDist, out double sigmaDist)

Description

dist_ellipse_contour_xlddist_ellipse_contour_xldDistEllipseContourXlddist_ellipse_contour_xldDistEllipseContourXldDistEllipseContourXld determines the distance between the contours in ContoursContoursContoursContoursContourscontours and an ellipse specified by the center (RowRowRowRowRowrow, ColumnColumnColumnColumnColumncolumn), the orientation of the main axis PhiPhiPhiPhiPhiphi, the length of the larger half axis Radius1Radius1Radius1Radius1Radius1radius1, and the length of the smaller half axis Radius2Radius2Radius2Radius2Radius2radius2. Different measures for the distance of a contour point to the ellipse are available (ModeModeModeModeModemode):

'geometric'

The underlying distance measure is the geometric distance between a point on the contour and the ellipse. This measure is also called orthogonal or euclidian distance.

'algebraic'

The distance is measured by the algebraic distance

, where the parameters a - f describing the ellipse are normalized in order to obtain Radius2Radius2Radius2Radius2Radius2radius2 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.

'focpoints'

The distance is measured by the deviation , where are the focal points and a corresponds to Radius1Radius1Radius1Radius1Radius1radius1. 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 good approximation of the orthogonal distance from X to the ellipse. The accuracy of the approximation depends on both the aspect ratio of the ellipse and the distance.

The operator returns the minimum absolute distance MinDistMinDistMinDistMinDistMinDistminDist, the maximum absolute distance MaxDistMaxDistMaxDistMaxDistMaxDistmaxDist, the average absolute distance AvgDistAvgDistAvgDistAvgDistAvgDistavgDist, and the standard deviation of the absolute distances SigmaDistSigmaDistSigmaDistSigmaDistSigmaDistsigmaDist 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 MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPoints, only up to MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPoints points - uniformly distributed over the contour - are used. Due to artifacts in the pre-processing the start and end points of a contour might be faulty. Therefore, it is possible to exclude ClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsclippingEndPoints points at the beginning and at the end of a contour from the computation.

Parallelization

Parameters

ContoursContoursContoursContoursContourscontours (input_object)  xld_cont(-array) objectHXLDContHXLDContHXLDContHXLDContXHobject

Input contours.

ModeModeModeModeModemode (input_control)  string HTupleHTupleHTupleVARIANTHtuple (string) (string) (HString) (char*) (BSTR) (char*)

Method for the determination of the distances.

Default value: 'geometric' "geometric" "geometric" "geometric" "geometric" "geometric"

List of values: 'algebraic'"algebraic""algebraic""algebraic""algebraic""algebraic", 'bisec'"bisec""bisec""bisec""bisec""bisec", 'focpoints'"focpoints""focpoints""focpoints""focpoints""focpoints", 'geometric'"geometric""geometric""geometric""geometric""geometric"

MaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsMaxNumPointsmaxNumPoints (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

Maximum number of contour points used for the computation (-1 for all points).

Default value: -1

Restriction: MaxNumPoints >= 3

ClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsClippingEndPointsclippingEndPoints (input_control)  integer HTupleHTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong) (Hlong)

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

RowRowRowRowRowrow (input_control)  ellipse.center.y HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Row coordinate of the center of the ellipse.

ColumnColumnColumnColumnColumncolumn (input_control)  ellipse.center.x HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Column coordinate of the center of the ellipse.

PhiPhiPhiPhiPhiphi (input_control)  ellipse.angle.rad HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Orientation of the main axis in radian.

Restriction: Phi >= 0 && Phi <= 6.283185307

Radius1Radius1Radius1Radius1Radius1radius1 (input_control)  ellipse.radius1 HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Length of the larger half axis.

Restriction: Radius1 > 0

Radius2Radius2Radius2Radius2Radius2radius2 (input_control)  ellipse.radius2 HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Length of the smaller half axis.

Restriction: Radius2 >= 0 && Radius2 <= Radius1

MinDistMinDistMinDistMinDistMinDistminDist (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Minimum distance.

MaxDistMaxDistMaxDistMaxDistMaxDistmaxDist (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Maximum distance.

AvgDistAvgDistAvgDistAvgDistAvgDistavgDist (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Mean distance.

SigmaDistSigmaDistSigmaDistSigmaDistSigmaDistsigmaDist (output_control)  real(-array) HTupleHTupleHTupleVARIANTHtuple (real) (double) (double) (double) (double) (double)

Standard deviation of the distance.

Example (HDevelop)

read_image (Image, 'caltab')
find_caltab (Image, CalPlate, 'caltab_big.descr', 3, 112, 5)
reduce_domain (Image, CalPlate, 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, 'contour_length', 20, 100, \
                     0, 0)
fit_ellipse_contour_xld (EdgesMarks, 'fitzgibbon', -1, 2, 0, 200, 3, 2.0, \
                         Row, Column, Phi, Radius1, Radius2, StartPhi, \
                         EndPhi, PointOrder)
for i := 0 to |Row|-1 by 1
    select_obj (EdgesMarks, ObjectSelected, i+1)
    dist_ellipse_contour_xld (ObjectSelected, 'bisec', -1, 0, Row[i], \
                              Column[i], Phi[i], Radius1[i], Radius2[i], \
                              MinDist, MaxDist, AvgDist, SigmaDist)
endfor

Example (HDevelop)

read_image (Image, 'caltab')
find_caltab (Image, CalPlate, 'caltab_big.descr', 3, 112, 5)
reduce_domain (Image, CalPlate, 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, 'contour_length', 20, 100, \
                     0, 0)
fit_ellipse_contour_xld (EdgesMarks, 'fitzgibbon', -1, 2, 0, 200, 3, 2.0, \
                         Row, Column, Phi, Radius1, Radius2, StartPhi, \
                         EndPhi, PointOrder)
for i := 0 to |Row|-1 by 1
    select_obj (EdgesMarks, ObjectSelected, i+1)
    dist_ellipse_contour_xld (ObjectSelected, 'bisec', -1, 0, Row[i], \
                              Column[i], Phi[i], Radius1[i], Radius2[i], \
                              MinDist, MaxDist, AvgDist, SigmaDist)
endfor

Example (HDevelop)

read_image (Image, 'caltab')
find_caltab (Image, CalPlate, 'caltab_big.descr', 3, 112, 5)
reduce_domain (Image, CalPlate, 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, 'contour_length', 20, 100, \
                     0, 0)
fit_ellipse_contour_xld (EdgesMarks, 'fitzgibbon', -1, 2, 0, 200, 3, 2.0, \
                         Row, Column, Phi, Radius1, Radius2, StartPhi, \
                         EndPhi, PointOrder)
for i := 0 to |Row|-1 by 1
    select_obj (EdgesMarks, ObjectSelected, i+1)
    dist_ellipse_contour_xld (ObjectSelected, 'bisec', -1, 0, Row[i], \
                              Column[i], Phi[i], Radius1[i], Radius2[i], \
                              MinDist, MaxDist, AvgDist, SigmaDist)
endfor

Example (C++ (HALCON 5.0-10.0))

read_image (Image, "caltab");
find_caltab (Image, &CalPlate, "caltab_big.descr", 3, 112, 5)
reduce_domain (Image, CalPlate, &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, "contour_length", 20, 100,
                     0, 0);
fit_ellipse_contour_xld (EdgesMarks, "fitzgibbon", -1, 2, 0, 200, 3, 2.0,
                         &Row, &Column, &Phi, &Radius1, &Radius2,
                         &StartPhi, &EndPhi, &PointOrder);
for (i=0; i<Row.Num(); i++)
{
  select_obj (EdgesMarks, &ObjectSelected, i+1);
  dist_ellipse_contour_xld (ObjectSelected, "bisec", -1, 0, Row[i],
                            Column[i], Phi[i], Radius1[i], Radius2[i],
                            &MinDist, &MaxDist, &AvgDist, &SigmaDist);
}

Example (HDevelop)

read_image (Image, 'caltab')
find_caltab (Image, CalPlate, 'caltab_big.descr', 3, 112, 5)
reduce_domain (Image, CalPlate, 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, 'contour_length', 20, 100, \
                     0, 0)
fit_ellipse_contour_xld (EdgesMarks, 'fitzgibbon', -1, 2, 0, 200, 3, 2.0, \
                         Row, Column, Phi, Radius1, Radius2, StartPhi, \
                         EndPhi, PointOrder)
for i := 0 to |Row|-1 by 1
    select_obj (EdgesMarks, ObjectSelected, i+1)
    dist_ellipse_contour_xld (ObjectSelected, 'bisec', -1, 0, Row[i], \
                              Column[i], Phi[i], Radius1[i], Radius2[i], \
                              MinDist, MaxDist, AvgDist, SigmaDist)
endfor

Example (HDevelop)

read_image (Image, 'caltab')
find_caltab (Image, CalPlate, 'caltab_big.descr', 3, 112, 5)
reduce_domain (Image, CalPlate, 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, 'contour_length', 20, 100, \
                     0, 0)
fit_ellipse_contour_xld (EdgesMarks, 'fitzgibbon', -1, 2, 0, 200, 3, 2.0, \
                         Row, Column, Phi, Radius1, Radius2, StartPhi, \
                         EndPhi, PointOrder)
for i := 0 to |Row|-1 by 1
    select_obj (EdgesMarks, ObjectSelected, i+1)
    dist_ellipse_contour_xld (ObjectSelected, 'bisec', -1, 0, Row[i], \
                              Column[i], Phi[i], Radius1[i], Radius2[i], \
                              MinDist, MaxDist, AvgDist, SigmaDist)
endfor

Result

dist_ellipse_contour_xlddist_ellipse_contour_xldDistEllipseContourXlddist_ellipse_contour_xldDistEllipseContourXldDistEllipseContourXld returns 2 (H_MSG_TRUE) if all parameter values are correct. If necessary, an exception is raised.

Possible Predecessors

fit_ellipse_contour_xldfit_ellipse_contour_xldFitEllipseContourXldfit_ellipse_contour_xldFitEllipseContourXldFitEllipseContourXld

Alternatives

dist_ellipse_contour_points_xlddist_ellipse_contour_points_xldDistEllipseContourPointsXlddist_ellipse_contour_points_xldDistEllipseContourPointsXldDistEllipseContourPointsXld

Module

Foundation


ClassesClassesClassesClasses | | | | Operators