Herror ::area_center_xld (
    Hobject XLD,
    double *Area,
    double *Row,
    double *Column,
    char *PointOrder
)
Herror ::area_center_xld (
    Hobject XLD,
    HTuple *Area,
    HTuple *Row,
    HTuple *Column,
    HTuple *PointOrder
)

Area and center of gravity (centroid) of contours and polygons.

::area_center_xld calculates the area and center of gravity (centroid) of the region enclosed by the contours or polygons XLD as well as the order of the points along the boundary. The area and centroid are computed by applying Green's theorem using only the points on the contour or polygon, i.e., no region is generated explicitly for the purpose of calculating the features. It is assumed that the contours or polygons are closed. If this is not the case ::area_center_xld will add one point to artificially produce a closed shape. If more than one contour or polygon is passed the results are stored as tuples in which the index of a value corresponds to the index of the respective contour or polygon in XLD.


Parameters

XLD (input_object)
xld(-array) -> Hobject: HXLD(Array)
Contours or polygons to be examined.

Area (output_control)
real(-array) -> (HTuple.) double *
Area enclosed by the contour or polygon.

Row (output_control)
point.y(-array) -> (HTuple.) double *
Row coordinate of the centroid.

Column (output_control)
point.x(-array) -> (HTuple.) double *
Column coordinate of the centroid.

PointOrder (output_control)
string(-array) -> (HTuple.) char *
point order along the boundary ("positive"/"negative").


Complexity

Let n be the number of points of the contour or polygon. Then the run time is O(n).


Result

::area_center_xld returns H_MSG_TRUE if the input is not empty. If the input is empty the behaviour can be set via ::set_system('no_object_result',<Result>). If necessary, an exception is raised.


Possible Predecessors

::gen_contours_skeleton_xld, ::smooth_contours_xld, ::gen_polygons_xld


See also

::moments_xld, ::area_center, ::moments_region_2nd


Module

Sub-pixel operators



Copyright © 1996-2002 MVTec Software GmbH