height_width_ratioheight_width_ratioHeightWidthRatioHeightWidthRatioheight_width_ratio (算子)

名称

height_width_ratioheight_width_ratioHeightWidthRatioHeightWidthRatioheight_width_ratio — 计算平行于坐标轴的周围矩形的宽度、高度和纵横比。

签名

height_width_ratio(Regions : : : Height, Width, Ratio)

Herror height_width_ratio(const Hobject Regions, Hlong* Height, Hlong* Width, double* Ratio)

Herror T_height_width_ratio(const Hobject Regions, Htuple* Height, Htuple* Width, Htuple* Ratio)

void HeightWidthRatio(const HObject& Regions, HTuple* Height, HTuple* Width, HTuple* Ratio)

HTuple HRegion::HeightWidthRatio(HTuple* Width, HTuple* Ratio) const

Hlong HRegion::HeightWidthRatio(Hlong* Width, double* Ratio) const

static void HOperatorSet.HeightWidthRatio(HObject regions, out HTuple height, out HTuple width, out HTuple ratio)

HTuple HRegion.HeightWidthRatio(out HTuple width, out HTuple ratio)

int HRegion.HeightWidthRatio(out int width, out double ratio)

def height_width_ratio(regions: HObject) -> Tuple[Sequence[int], Sequence[int], Sequence[float]]

def height_width_ratio_s(regions: HObject) -> Tuple[int, int, float]

描述

The operator height_width_ratioheight_width_ratioHeightWidthRatioHeightWidthRatioHeightWidthRatioheight_width_ratio calculates the surrounding rectangle of all input regions (parallel to the coordinate axes). The surrounding rectangle is described by the coordinates of the corner pixels (Row1Row1Row1Row1row1row_1,Column1Column1Column1Column1column1column_1,Row2Row2Row2Row2row2row_2,Column2Column2Column2Column2column2column_2) (see smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1SmallestRectangle1smallest_rectangle1). Based on these values, height_width_ratioheight_width_ratioHeightWidthRatioHeightWidthRatioHeightWidthRatioheight_width_ratio computes the width, height, and aspect ratio of the smallest surrounding rectangle as follows:

If more than one region is passed in RegionsRegionsRegionsRegionsregionsregions, the results are stored in tuples in the same order as the respective regions in the RegionsRegionsRegionsRegionsregionsregions. In case of empty regions, all parameters have the value 0 if no other behavior was set (see set_systemset_systemSetSystemSetSystemSetSystemset_system).

执行信息

参数

RegionsRegionsRegionsRegionsregionsregions (input_object)  region(-array) objectHRegionHObjectHRegionHobject

Regions to be examined.

HeightHeightHeightHeightheightheight (output_control)  extent.y(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Height of the surrounding rectangle of the region.

WidthWidthWidthWidthwidthwidth (output_control)  extent.x(-array) HTupleSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Width of the surrounding rectangle of the region.

RatioRatioRatioRatioratioratio (output_control)  real(-array) HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)

Aspect ratio of the surrounding rectangle of the region.

复杂性

若 F 为区域面积,则平均运行时间复杂生为 O(√F)。

结果

The operator height_width_ratioheight_width_ratioHeightWidthRatioHeightWidthRatioHeightWidthRatioheight_width_ratio returns the value 2 ( H_MSG_TRUE) if the input is not empty. The behavior in case of empty input (no input regions available) is set via the operator 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>). The behavior in case of empty region (the region is the empty set) is set via set_system('empty_region_result',<Result>)set_system("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)SetSystem("empty_region_result",<Result>)set_system("empty_region_result",<Result>). If necessary an exception is raised.

可能的前趋

thresholdthresholdThresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionConnectionconnection, runlength_featuresrunlength_featuresRunlengthFeaturesRunlengthFeaturesRunlengthFeaturesrunlength_features

替代

smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1SmallestRectangle1smallest_rectangle1, smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2, region_featuresregion_featuresRegionFeaturesRegionFeaturesRegionFeaturesregion_features

另见

select_shapeselect_shapeSelectShapeSelectShapeSelectShapeselect_shape, smallest_circlesmallest_circleSmallestCircleSmallestCircleSmallestCirclesmallest_circle, elliptic_axiselliptic_axisEllipticAxisEllipticAxisEllipticAxiselliptic_axis, area_centerarea_centerAreaCenterAreaCenterAreaCenterarea_center

模块

Foundation