convexity_xld ( XLD : : : Convexity )

Shape factor for the convexity of a contour.

The operator convexity_xld calculates the convexity of the input contour. The input contour must not intersect itself, otherwise the resulting parameter is not meaningful. If the input contour is not closed it will be closed automatically.

Calculation: If Fc is the area of the convex hull and Fo the area 
             enclosed by the original contour the shape factor 
             Convexity is defined as:
	      
                  Convexity = Fo / Fc
The shape factor Convexity is 1 if the contour is convex (e.g., a rectangle, circle, etc.). If there are indentations Convexity is smaller than 1.

If more than one contour is passed the numerical values of the shape factor are stored in a tuple, the position of a value in the tuple corresponding to the position of the contour in the input tuple.


Parameters

XLD (input_object)
xld(-array) -> object
Contour(s) to be examined.

Convexity (output_control)
real(-array) -> real
Convexity of the input contour(s).
Assertion: Convexity <= 1


Result

The operator convexity_xld returns the value 2 (H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input contour available) is set via the operator set_system('no_object_result',<Result>). If necessary an exception is raised.


Parallelization Information

convexity_xld is reentrant and automatically parallelized (on tuple level).


Possible Predecessors

gen_contours_skeleton_xld, edges_sub_pix, threshold_sub_pix, gen_contour_polygon_xld


See also

area_center_xld, select_shape_xld, shape_trans_xld


Module

Sub-pixel operators



Copyright © 1996-2005 MVTec Software GmbH