smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2 (算子名称)
名称
smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2 — Smallest surrounding rectangle with any orientation.
参数签名
Herror smallest_rectangle2(const Hobject 区域, double* Row, double* Column, double* Phi, double* Length1, double* Length2)
Herror T_smallest_rectangle2(const Hobject 区域, Htuple* Row, Htuple* Column, Htuple* Phi, Htuple* Length1, Htuple* Length2)
void SmallestRectangle2(const HObject& 区域, HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2)
void HRegion::SmallestRectangle2(HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2) const
void HRegion::SmallestRectangle2(double* Row, double* Column, double* Phi, double* Length1, double* Length2) const
static void HOperatorSet.SmallestRectangle2(HObject 区域, out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2)
void HRegion.SmallestRectangle2(out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2)
void HRegion.SmallestRectangle2(out double row, out double column, out double phi, out double length1, out double length2)
def smallest_rectangle2(区域: HObject) -> Tuple[Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]
def smallest_rectangle2_s(区域: HObject) -> Tuple[float, float, float, float, float]
描述
该算子 smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2 determines the smallest
surrounding rectangle of a region, i.e., the rectangle with the smallest
area of all rectangles containing the region.
For this rectangle the center,
the inclination and the two radii are calculated.
The calculation of the rectangle is based on the center coordinates of
the region pixels.
In the documentation of this chapter (Regions / Features), you can
find an image illustrating regions which vary in the length and phi of their
smallest surrounding rectangle.
该算子 is applied when, for example, the location of a scenery of
several regions (e.g., printed text on a rectangular paper or
in rectangular print (justified lines)) must be found.
The parameters of smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2 are chosen in such a way
that they can be used directly as input for 该算子s
disp_rectangle2disp_rectangle2DispRectangle2DispRectangle2DispRectangle2disp_rectangle2 and gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2GenRectangle2gen_rectangle2.
If more than one region is passed in 区域区域区域区域区域区域 the results are
stored in tuples, the index of a value in the tuple corresponding to the
index of a region in the input. In case of empty region all parameters
have the value 0.0 if no other behavior was set (see set_systemset_systemSetSystemSetSystemSetSystemset_system).
运行信息
- 多线程类型:可重入(与非独占操作符并行运行)。
- 多线程作用域:全局(可以从任何线程调用)。
- 在元组级别自动并行化。
参数表
区域区域区域区域区域区域 (input_object) region(-array) → objectHRegionHObjectHRegionHobject
Regions to be examined.
RowRowRowRowrowrow (output_control) rectangle2.center.y(-array) → HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Line index of the center.
ColumnColumnColumnColumncolumncolumn (output_control) rectangle2.center.x(-array) → HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Column index of the center.
PhiPhiPhiPhiphiphi (output_control) rectangle2.angle.rad(-array) → HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Orientation of the surrounding rectangle (arc measure)
Assertion:
- pi / 2 < Phi && Phi <= pi / 2
Length1Length1Length1Length1length1length_1 (output_control) rectangle2.hwidth(-array) → HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
First radius (half length) of the surrounding
rectangle.
Assertion:
Length1 >= 0.0
Length2Length2Length2Length2length2length_2 (output_control) rectangle2.hheight(-array) → HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Second radius (half width) of the surrounding
rectangle.
Assertion:
Length2 >= 0.0 && Length2 <= Length1
例程 (HDevelop)
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
smallest_rectangle2(Regions,Row,Column,Phi,Length1,Length2)
gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)
dev_set_draw ('margin')
dev_display(Rectangle)
例程 (HDevelop)
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
smallest_rectangle2(Regions,Row,Column,Phi,Length1,Length2)
gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)
dev_set_draw ('margin')
dev_display(Rectangle)
例程 (HDevelop)
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
smallest_rectangle2(Regions,Row,Column,Phi,Length1,Length2)
gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)
dev_set_draw ('margin')
dev_display(Rectangle)
例程 (HDevelop)
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
smallest_rectangle2(Regions,Row,Column,Phi,Length1,Length2)
gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)
dev_set_draw ('margin')
dev_display(Rectangle)
例程 (HDevelop)
read_image(Image,'fabrik')
regiongrowing(Image,Regions,5,5,6,100)
smallest_rectangle2(Regions,Row,Column,Phi,Length1,Length2)
gen_rectangle2(Rectangle,Row,Column,Phi,Length1,Length2)
dev_set_draw ('margin')
dev_display(Rectangle)
Complexity
If F is the area of the region and N is the number of supporting points
of the convex hull, the runtime complexity is O(sqrt(F) + N^2).
结果
该算子 smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2 返回值 2 (
H_MSG_TRUE)
if the input is not empty. The behavior in case of empty input (no input regions available)
is set via 该算子 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
可能的后置算子
disp_rectangle2disp_rectangle2DispRectangle2DispRectangle2DispRectangle2disp_rectangle2,
gen_rectangle2gen_rectangle2GenRectangle2GenRectangle2GenRectangle2gen_rectangle2
可替代算子
elliptic_axiselliptic_axisEllipticAxisEllipticAxisEllipticAxiselliptic_axis,
smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1SmallestRectangle1smallest_rectangle1
参考其它
smallest_circlesmallest_circleSmallestCircleSmallestCircleSmallestCirclesmallest_circle,
set_shapeset_shapeSetShapeSetShapeSetShapeset_shape
模块
Foundation