HALCON Reference Manual 10.0.2
Table of Contents / Regions / Transformations ClassesClassesClasses | | | Operators

shape_transshape_transshape_transShapeTransShapeTrans (Operator)

Name

shape_transshape_transshape_transShapeTransShapeTrans — Transform the shape of a region.

Signature

shape_trans(Region : RegionTrans : Type : )

Herror shape_trans(const Hobject Region, Hobject* RegionTrans, const char* Type)

Herror T_shape_trans(const Hobject Region, Hobject* RegionTrans, const Htuple Type)

Herror shape_trans(Hobject Region, Hobject* RegionTrans, const HTuple& Type)

HRegion HRegion::ShapeTrans(const HTuple& Type) const

HRegionArray HRegionArray::ShapeTrans(const HTuple& Type) const

void HOperatorSetX.ShapeTrans(
[in] IHUntypedObjectX* Region, [out] IHUntypedObjectX*RegionTrans, [in] VARIANT Type)

IHRegionX* HRegionX.ShapeTrans([in] BSTR Type)

static void HOperatorSet.ShapeTrans(HObject region, out HObject regionTrans, HTuple type)

HRegion HRegion.ShapeTrans(string type)

Description

shape_transshape_transshape_transShapeTransShapeTrans transforms the shape of the input regions depending on the parameter TypeTypeTypeTypetype:

'convex'

Convex hull.

'ellipse'

Ellipse with the same moments and area as the input region.

'outer_circle'

Smallest enclosing circle.

'inner_circle'

Largest circle fitting into the region.

'rectangle1'

Smallest enclosing rectangle parallel to the coordinate axes.

'rectangle2'

Smallest enclosing rectangle.

'inner_rectangle1'

Largest axis-parallel rectangle fitting into the region.

'inner_center'

The point on the skeleton of the input region having the smallest distance to the center of gravity of the input region.

Attention

If TypeTypeTypeTypetype = 'outer_circle'"outer_circle""outer_circle""outer_circle""outer_circle" is selected it might happen that the resulting circular region does not completely cover the input region. This is because internally the operators smallest_circlesmallest_circlesmallest_circleSmallestCircleSmallestCircle and gen_circlegen_circlegen_circleGenCircleGenCircle are used to compute the outer circle. As described in the documentation of smallest_circlesmallest_circlesmallest_circleSmallestCircleSmallestCircle, the calculated radius can be too small by up to 1/sqrt(2)-0.5 pixels. Additionally, the circle that is generated by gen_circlegen_circlegen_circleGenCircleGenCircle is translated by up to 0.5 pixels in both directions, i.e., by up to 1/sqrt(2) pixels. Consequently, when adding up both effects, the original region might protrude beyond the returned circular region by at most 1 pixel.

Parallelization

Parameters

RegionRegionRegionRegionregion (input_object)  region(-array) objectHRegionHRegionHRegionXHobject

Regions to be transformed.

RegionTransRegionTransRegionTransRegionTransregionTrans (output_object)  region(-array) objectHRegionHRegionHRegionXHobject *

Transformed regions.

TypeTypeTypeTypetype (input_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Type of transformation.

Default value: 'convex' "convex" "convex" "convex" "convex"

List of values: 'convex'"convex""convex""convex""convex", 'ellipse'"ellipse""ellipse""ellipse""ellipse", 'outer_circle'"outer_circle""outer_circle""outer_circle""outer_circle", 'inner_circle'"inner_circle""inner_circle""inner_circle""inner_circle", 'rectangle1'"rectangle1""rectangle1""rectangle1""rectangle1", 'rectangle2'"rectangle2""rectangle2""rectangle2""rectangle2", 'inner_rectangle1'"inner_rectangle1""inner_rectangle1""inner_rectangle1""inner_rectangle1", 'inner_center'"inner_center""inner_center""inner_center""inner_center"

Complexity

Let F be the area of the input region. Then the runtime complexity is O(F).

Result

shape_transshape_transshape_transShapeTransShapeTrans returns 2 (H_MSG_TRUE) if all parameters are correct. The behavior in case of empty input (no regions given) can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

connectionconnectionconnectionConnectionConnection, regiongrowingregiongrowingregiongrowingRegiongrowingRegiongrowing

Possible Successors

disp_regiondisp_regiondisp_regionDispRegionDispRegion, regiongrowing_meanregiongrowing_meanregiongrowing_meanRegiongrowingMeanRegiongrowingMean, area_centerarea_centerarea_centerAreaCenterAreaCenter

See also

convexityconvexityconvexityConvexityConvexity, elliptic_axiselliptic_axiselliptic_axisEllipticAxisEllipticAxis, area_centerarea_centerarea_centerAreaCenterAreaCenter, smallest_rectangle1smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1, smallest_rectangle2smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2, inner_rectangle1inner_rectangle1inner_rectangle1InnerRectangle1InnerRectangle1, set_shapeset_shapeset_shapeSetShapeSetShape, select_shapeselect_shapeselect_shapeSelectShapeSelectShape, inner_circleinner_circleinner_circleInnerCircleInnerCircle

Module

Foundation


Table of Contents / Regions / Transformations ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH