shape_transshape_transShapeTransShapeTransshape_trans (算子)

名称

shape_transshape_transShapeTransShapeTransshape_trans — 变换区域的形状。

签名

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)

void ShapeTrans(const HObject& Region, HObject* RegionTrans, const HTuple& Type)

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

HRegion HRegion::ShapeTrans(const char* Type) const

HRegion HRegion::ShapeTrans(const wchar_t* Type) const   ( Windows only)

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

HRegion HRegion.ShapeTrans(string type)

def shape_trans(region: HObject, type: str) -> HObject

描述

shape_transshape_transShapeTransShapeTransShapeTransshape_trans transforms the shape of the input regions depending on the parameter TypeTypeTypeTypetypetype:

'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.

注意

If TypeTypeTypeTypetypetype = 'outer_circle'"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_circleSmallestCircleSmallestCircleSmallestCirclesmallest_circle and gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle are used to compute the outer circle. As described in the documentation of smallest_circlesmallest_circleSmallestCircleSmallestCircleSmallestCirclesmallest_circle, the calculated radius can be too small by up to pixels. Additionally, the circle that is generated by gen_circlegen_circleGenCircleGenCircleGenCirclegen_circle is translated by up to 0.5 pixels in both directions, i.e., by up to pixels. Consequently, when adding up both effects, the original region might protrude beyond the returned circular region by at most 1 pixel.

执行信息

参数

RegionRegionRegionRegionregionregion (输入对象)  region(-array) objectHRegionHObjectHRegionHobject

Regions to be transformed.

RegionTransRegionTransRegionTransRegionTransregionTransregion_trans (输出对象)  region(-array) objectHRegionHObjectHRegionHobject *

Transformed regions.

TypeTypeTypeTypetypetype (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Type of transformation.

默认值: 'convex' "convex" "convex" "convex" "convex" "convex"

值列表: 'convex'"convex""convex""convex""convex""convex", 'ellipse'"ellipse""ellipse""ellipse""ellipse""ellipse", 'inner_center'"inner_center""inner_center""inner_center""inner_center""inner_center", 'inner_circle'"inner_circle""inner_circle""inner_circle""inner_circle""inner_circle", 'inner_rectangle1'"inner_rectangle1""inner_rectangle1""inner_rectangle1""inner_rectangle1""inner_rectangle1", 'outer_circle'"outer_circle""outer_circle""outer_circle""outer_circle""outer_circle", 'rectangle1'"rectangle1""rectangle1""rectangle1""rectangle1""rectangle1", 'rectangle2'"rectangle2""rectangle2""rectangle2""rectangle2""rectangle2"

复杂度

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

结果

shape_transshape_transShapeTransShapeTransShapeTransshape_trans 在所有参数正确时返回 2 ( H_MSG_TRUE )。当输入为空(未指定区域)时则可设置行为通过 set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)set_system("no_object_result",<Result>)。如有必要,则抛出异常。

可能的前趋

connectionconnectionConnectionConnectionConnectionconnection, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing

可能的后继

disp_regiondisp_regionDispRegionDispRegionDispRegiondisp_region, regiongrowing_meanregiongrowing_meanRegiongrowingMeanRegiongrowingMeanRegiongrowingMeanregiongrowing_mean, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center

另见

convexityconvexityConvexityConvexityConvexityconvexity, elliptic_axiselliptic_axisEllipticAxisEllipticAxisEllipticAxiselliptic_axis, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center, smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1SmallestRectangle1smallest_rectangle1, smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2, inner_rectangle1inner_rectangle1InnerRectangle1InnerRectangle1InnerRectangle1inner_rectangle1, set_shapeset_shapeSetShapeSetShapeSetShapeset_shape, select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, inner_circleinner_circleInnerCircleInnerCircleInnerCircleinner_circle

模块

基础