region_featuresregion_featuresRegionFeaturesRegionFeaturesregion_features (Operator)

Name

region_featuresregion_featuresRegionFeaturesRegionFeaturesregion_features — Calculate shape features of regions.

Signature

region_features(Regions : : Features : Value)

Herror region_features(const Hobject Regions, const char* Features, double* Value)

Herror T_region_features(const Hobject Regions, const Htuple Features, Htuple* Value)

void RegionFeatures(const HObject& Regions, const HTuple& Features, HTuple* Value)

HTuple HRegion::RegionFeatures(const HTuple& Features) const

double HRegion::RegionFeatures(const HString& Features) const

double HRegion::RegionFeatures(const char* Features) const

double HRegion::RegionFeatures(const wchar_t* Features) const   ( Windows only)

static void HOperatorSet.RegionFeatures(HObject regions, HTuple features, out HTuple value)

HTuple HRegion.RegionFeatures(HTuple features)

double HRegion.RegionFeatures(string features)

def region_features(regions: HObject, features: MaybeSequence[str]) -> Sequence[float]

def region_features_s(regions: HObject, features: MaybeSequence[str]) -> float

Description

The operator region_featuresregion_featuresRegionFeaturesRegionFeaturesregion_features calculates for each input region from RegionsRegionsRegionsregionsregions the indicated features (FeaturesFeaturesFeaturesfeaturesfeatures).

For an illustration of these features, please refer to the documentation of this chapter (Regions / Features).

Possible values for FeaturesFeaturesFeaturesfeaturesfeatures:

'area'"area""area""area""area":

Area of the object

'row'"row""row""row""row":

Row index of the center

'column'"column""column""column""column":

Column index of the center

'row1'"row1""row1""row1""row1":

Row index of upper left corner

'column1'"column1""column1""column1""column1":

Column index of upper left corner

'row2'"row2""row2""row2""row2":

Row index of lower right corner

'column2'"column2""column2""column2""column2":

Column index of lower right corner

'width'"width""width""width""width":

Width of the region (parallel to the coordinate axes)

'height'"height""height""height""height":

Height of the region (parallel to the coordinate axes)

'ratio'"ratio""ratio""ratio""ratio":

Ratio of the height and the width of the region (parallel to the coordinate axes)

'circularity'"circularity""circularity""circularity""circularity":

Circularity (see circularitycircularityCircularityCircularitycircularity)

'compactness'"compactness""compactness""compactness""compactness":

Compactness (see compactnesscompactnessCompactnessCompactnesscompactness)

'contlength'"contlength""contlength""contlength""contlength":

Total length of contour (see operator contlengthcontlengthContlengthContlengthcontlength)

'convexity'"convexity""convexity""convexity""convexity":

Convexity (see convexityconvexityConvexityConvexityconvexity)

'rectangularity'"rectangularity""rectangularity""rectangularity""rectangularity":

Rectangularity (see rectangularityrectangularityRectangularityRectangularityrectangularity)

'ra'"ra""ra""ra""ra":

Main radius of the equivalent ellipse (see elliptic_axiselliptic_axisEllipticAxisEllipticAxiselliptic_axis)

'rb'"rb""rb""rb""rb":

Secondary radius of the equivalent ellipse (see elliptic_axiselliptic_axisEllipticAxisEllipticAxiselliptic_axis)

'phi'"phi""phi""phi""phi":

Orientation of the equivalent ellipse (see elliptic_axiselliptic_axisEllipticAxisEllipticAxiselliptic_axis)

'anisometry'"anisometry""anisometry""anisometry""anisometry":

Anisometry (see eccentricityeccentricityEccentricityEccentricityeccentricity)

'bulkiness'"bulkiness""bulkiness""bulkiness""bulkiness":

Bulkiness (see operator eccentricityeccentricityEccentricityEccentricityeccentricity)

'struct_factor'"struct_factor""struct_factor""struct_factor""struct_factor":

Structure Factor (see operator eccentricityeccentricityEccentricityEccentricityeccentricity)

'outer_radius'"outer_radius""outer_radius""outer_radius""outer_radius":

Radius of smallest surrounding circle (see smallest_circlesmallest_circleSmallestCircleSmallestCirclesmallest_circle)

'inner_radius'"inner_radius""inner_radius""inner_radius""inner_radius":

Radius of largest inner circle (see inner_circleinner_circleInnerCircleInnerCircleinner_circle)

'inner_width'"inner_width""inner_width""inner_width""inner_width":

Width of the largest axis-parallel rectangle that fits into the region (see inner_rectangle1inner_rectangle1InnerRectangle1InnerRectangle1inner_rectangle1)

'inner_height'"inner_height""inner_height""inner_height""inner_height":

Height of the largest axis-parallel rectangle that fits into the region (see inner_rectangle1inner_rectangle1InnerRectangle1InnerRectangle1inner_rectangle1)

'dist_mean'"dist_mean""dist_mean""dist_mean""dist_mean":

Mean distance from the region border to the center (see operator roundnessroundnessRoundnessRoundnessroundness)

'dist_deviation'"dist_deviation""dist_deviation""dist_deviation""dist_deviation":

Deviation of the distance from the region border to the center (see operator roundnessroundnessRoundnessRoundnessroundness)

'roundness'"roundness""roundness""roundness""roundness":

Roundness (see operator roundnessroundnessRoundnessRoundnessroundness)

'num_sides'"num_sides""num_sides""num_sides""num_sides":

Number of polygon sides (see operator roundnessroundnessRoundnessRoundnessroundness)

'connect_num'"connect_num""connect_num""connect_num""connect_num":

Number of connection components (see operator connect_and_holesconnect_and_holesConnectAndHolesConnectAndHolesconnect_and_holes)

'holes_num'"holes_num""holes_num""holes_num""holes_num":

Number of holes (see operator connect_and_holesconnect_and_holesConnectAndHolesConnectAndHolesconnect_and_holes)

'area_holes'"area_holes""area_holes""area_holes""area_holes":

Area of the holes of the object (see operator area_holesarea_holesAreaHolesAreaHolesarea_holes)

'max_diameter'"max_diameter""max_diameter""max_diameter""max_diameter":

Maximum diameter of the region (see operator diameter_regiondiameter_regionDiameterRegionDiameterRegiondiameter_region)

'orientation'"orientation""orientation""orientation""orientation":

Orientation of the region (see operator orientation_regionorientation_regionOrientationRegionOrientationRegionorientation_region)

'euler_number'"euler_number""euler_number""euler_number""euler_number":

Euler number (see operator euler_numbereuler_numberEulerNumberEulerNumbereuler_number)

'rect2_phi'"rect2_phi""rect2_phi""rect2_phi""rect2_phi":

Orientation of the smallest surrounding rectangle (see operator smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2)

'rect2_len1'"rect2_len1""rect2_len1""rect2_len1""rect2_len1":

Half the length of the smallest surrounding rectangle (see operator smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2)

'rect2_len2'"rect2_len2""rect2_len2""rect2_len2""rect2_len2":

Half the width of the smallest surrounding rectangle (see operator smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2)

'moments_m11'"moments_m11""moments_m11""moments_m11""moments_m11":

Geometric moments of the region (see operator moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd)

'moments_m20'"moments_m20""moments_m20""moments_m20""moments_m20":

Geometric moments of the region (see operator moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd)

'moments_m02'"moments_m02""moments_m02""moments_m02""moments_m02":

Geometric moments of the region (see operator moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd)

'moments_ia'"moments_ia""moments_ia""moments_ia""moments_ia":

Geometric moments of the region (see operator moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd)

'moments_ib'"moments_ib""moments_ib""moments_ib""moments_ib":

Geometric moments of the region (see operator moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd)

'moments_m11_invar'"moments_m11_invar""moments_m11_invar""moments_m11_invar""moments_m11_invar":

Geometric moments of the region (see operator moments_region_2nd_invarmoments_region_2nd_invarMomentsRegion2ndInvarMomentsRegion2ndInvarmoments_region_2nd_invar)

'moments_m20_invar'"moments_m20_invar""moments_m20_invar""moments_m20_invar""moments_m20_invar":

Geometric moments of the region (see operator moments_region_2nd_invarmoments_region_2nd_invarMomentsRegion2ndInvarMomentsRegion2ndInvarmoments_region_2nd_invar)

'moments_m02_invar'"moments_m02_invar""moments_m02_invar""moments_m02_invar""moments_m02_invar":

Geometric moments of the region (see operator moments_region_2nd_invarmoments_region_2nd_invarMomentsRegion2ndInvarMomentsRegion2ndInvarmoments_region_2nd_invar)

'moments_phi1'"moments_phi1""moments_phi1""moments_phi1""moments_phi1":

Geometric moments of the region (see operator moments_region_2nd_rel_invarmoments_region_2nd_rel_invarMomentsRegion2ndRelInvarMomentsRegion2ndRelInvarmoments_region_2nd_rel_invar)

'moments_phi2'"moments_phi2""moments_phi2""moments_phi2""moments_phi2":

Geometric moments of the region (see operator moments_region_2nd_rel_invarmoments_region_2nd_rel_invarMomentsRegion2ndRelInvarMomentsRegion2ndRelInvarmoments_region_2nd_rel_invar)

'moments_m21'"moments_m21""moments_m21""moments_m21""moments_m21":

Geometric moments of the region (see operator moments_region_3rdmoments_region_3rdMomentsRegion3rdMomentsRegion3rdmoments_region_3rd)

'moments_m12'"moments_m12""moments_m12""moments_m12""moments_m12":

Geometric moments of the region (see operator moments_region_3rdmoments_region_3rdMomentsRegion3rdMomentsRegion3rdmoments_region_3rd)

'moments_m03'"moments_m03""moments_m03""moments_m03""moments_m03":

Geometric moments of the region (see operator moments_region_3rdmoments_region_3rdMomentsRegion3rdMomentsRegion3rdmoments_region_3rd)

'moments_m30'"moments_m30""moments_m30""moments_m30""moments_m30":

Geometric moments of the region (see operator moments_region_3rdmoments_region_3rdMomentsRegion3rdMomentsRegion3rdmoments_region_3rd)

'moments_m21_invar'"moments_m21_invar""moments_m21_invar""moments_m21_invar""moments_m21_invar":

Geometric moments of the region (see operator moments_region_3rd_invarmoments_region_3rd_invarMomentsRegion3rdInvarMomentsRegion3rdInvarmoments_region_3rd_invar)

'moments_m12_invar'"moments_m12_invar""moments_m12_invar""moments_m12_invar""moments_m12_invar":

Geometric moments of the region (see operator moments_region_3rd_invarmoments_region_3rd_invarMomentsRegion3rdInvarMomentsRegion3rdInvarmoments_region_3rd_invar)

'moments_m03_invar'"moments_m03_invar""moments_m03_invar""moments_m03_invar""moments_m03_invar":

Geometric moments of the region (see operator moments_region_3rd_invarmoments_region_3rd_invarMomentsRegion3rdInvarMomentsRegion3rdInvarmoments_region_3rd_invar)

'moments_m30_invar'"moments_m30_invar""moments_m30_invar""moments_m30_invar""moments_m30_invar":

Geometric moments of the region (see operator moments_region_3rd_invarmoments_region_3rd_invarMomentsRegion3rdInvarMomentsRegion3rdInvarmoments_region_3rd_invar)

'moments_i1'"moments_i1""moments_i1""moments_i1""moments_i1":

Geometric moments of the region (see operator moments_region_centralmoments_region_centralMomentsRegionCentralMomentsRegionCentralmoments_region_central)

'moments_i2'"moments_i2""moments_i2""moments_i2""moments_i2":

Geometric moments of the region (see operator moments_region_centralmoments_region_centralMomentsRegionCentralMomentsRegionCentralmoments_region_central)

'moments_i3'"moments_i3""moments_i3""moments_i3""moments_i3":

Geometric moments of the region (see operator moments_region_centralmoments_region_centralMomentsRegionCentralMomentsRegionCentralmoments_region_central)

'moments_i4'"moments_i4""moments_i4""moments_i4""moments_i4":

Geometric moments of the region (see operator moments_region_centralmoments_region_centralMomentsRegionCentralMomentsRegionCentralmoments_region_central)

'moments_psi1'"moments_psi1""moments_psi1""moments_psi1""moments_psi1":

Geometric moments of the region (see operator moments_region_central_invarmoments_region_central_invarMomentsRegionCentralInvarMomentsRegionCentralInvarmoments_region_central_invar)

'moments_psi2'"moments_psi2""moments_psi2""moments_psi2""moments_psi2":

Geometric moments of the region (see operator moments_region_central_invarmoments_region_central_invarMomentsRegionCentralInvarMomentsRegionCentralInvarmoments_region_central_invar)

'moments_psi3'"moments_psi3""moments_psi3""moments_psi3""moments_psi3":

Geometric moments of the region (see operator moments_region_central_invarmoments_region_central_invarMomentsRegionCentralInvarMomentsRegionCentralInvarmoments_region_central_invar)

'moments_psi4'"moments_psi4""moments_psi4""moments_psi4""moments_psi4":

Geometric moments of the region (see operator moments_region_central_invarmoments_region_central_invarMomentsRegionCentralInvarMomentsRegionCentralInvarmoments_region_central_invar)

Several features are processed in the sequence in which they are entered.

Execution Information

Parameters

RegionsRegionsRegionsregionsregions (input_object)  region-array objectHRegionHObjectHObjectHobject

Regions to be examined.

FeaturesFeaturesFeaturesfeaturesfeatures (input_control)  string(-array) HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)

Shape features to be calculated.

Default: 'area' "area" "area" "area" "area"

List of values: 'anisometry'"anisometry""anisometry""anisometry""anisometry", 'area'"area""area""area""area", 'area_holes'"area_holes""area_holes""area_holes""area_holes", 'bulkiness'"bulkiness""bulkiness""bulkiness""bulkiness", 'circularity'"circularity""circularity""circularity""circularity", 'column'"column""column""column""column", 'column1'"column1""column1""column1""column1", 'column2'"column2""column2""column2""column2", 'compactness'"compactness""compactness""compactness""compactness", 'connect_num'"connect_num""connect_num""connect_num""connect_num", 'contlength'"contlength""contlength""contlength""contlength", 'convexity'"convexity""convexity""convexity""convexity", 'dist_deviation'"dist_deviation""dist_deviation""dist_deviation""dist_deviation", 'dist_mean'"dist_mean""dist_mean""dist_mean""dist_mean", 'euler_number'"euler_number""euler_number""euler_number""euler_number", 'height'"height""height""height""height", 'holes_num'"holes_num""holes_num""holes_num""holes_num", 'inner_height'"inner_height""inner_height""inner_height""inner_height", 'inner_radius'"inner_radius""inner_radius""inner_radius""inner_radius", 'inner_width'"inner_width""inner_width""inner_width""inner_width", 'max_diameter'"max_diameter""max_diameter""max_diameter""max_diameter", 'moments_i1'"moments_i1""moments_i1""moments_i1""moments_i1", 'moments_i2'"moments_i2""moments_i2""moments_i2""moments_i2", 'moments_i3'"moments_i3""moments_i3""moments_i3""moments_i3", 'moments_i4'"moments_i4""moments_i4""moments_i4""moments_i4", 'moments_ia'"moments_ia""moments_ia""moments_ia""moments_ia", 'moments_ib'"moments_ib""moments_ib""moments_ib""moments_ib", 'moments_m02'"moments_m02""moments_m02""moments_m02""moments_m02", 'moments_m02_invar'"moments_m02_invar""moments_m02_invar""moments_m02_invar""moments_m02_invar", 'moments_m03'"moments_m03""moments_m03""moments_m03""moments_m03", 'moments_m03_invar'"moments_m03_invar""moments_m03_invar""moments_m03_invar""moments_m03_invar", 'moments_m11'"moments_m11""moments_m11""moments_m11""moments_m11", 'moments_m11_invar'"moments_m11_invar""moments_m11_invar""moments_m11_invar""moments_m11_invar", 'moments_m12'"moments_m12""moments_m12""moments_m12""moments_m12", 'moments_m12_invar'"moments_m12_invar""moments_m12_invar""moments_m12_invar""moments_m12_invar", 'moments_m20'"moments_m20""moments_m20""moments_m20""moments_m20", 'moments_m20_invar'"moments_m20_invar""moments_m20_invar""moments_m20_invar""moments_m20_invar", 'moments_m21'"moments_m21""moments_m21""moments_m21""moments_m21", 'moments_m21_invar'"moments_m21_invar""moments_m21_invar""moments_m21_invar""moments_m21_invar", 'moments_m30'"moments_m30""moments_m30""moments_m30""moments_m30", 'moments_m30_invar'"moments_m30_invar""moments_m30_invar""moments_m30_invar""moments_m30_invar", 'moments_phi1'"moments_phi1""moments_phi1""moments_phi1""moments_phi1", 'moments_phi2'"moments_phi2""moments_phi2""moments_phi2""moments_phi2", 'moments_psi1'"moments_psi1""moments_psi1""moments_psi1""moments_psi1", 'moments_psi2'"moments_psi2""moments_psi2""moments_psi2""moments_psi2", 'moments_psi3'"moments_psi3""moments_psi3""moments_psi3""moments_psi3", 'moments_psi4'"moments_psi4""moments_psi4""moments_psi4""moments_psi4", 'num_sides'"num_sides""num_sides""num_sides""num_sides", 'orientation'"orientation""orientation""orientation""orientation", 'outer_radius'"outer_radius""outer_radius""outer_radius""outer_radius", 'phi'"phi""phi""phi""phi", 'ra'"ra""ra""ra""ra", 'ratio'"ratio""ratio""ratio""ratio", 'rb'"rb""rb""rb""rb", 'rect2_len1'"rect2_len1""rect2_len1""rect2_len1""rect2_len1", 'rect2_len2'"rect2_len2""rect2_len2""rect2_len2""rect2_len2", 'rect2_phi'"rect2_phi""rect2_phi""rect2_phi""rect2_phi", 'rectangularity'"rectangularity""rectangularity""rectangularity""rectangularity", 'roundness'"roundness""roundness""roundness""roundness", 'row'"row""row""row""row", 'row1'"row1""row1""row1""row1", 'row2'"row2""row2""row2""row2", 'struct_factor'"struct_factor""struct_factor""struct_factor""struct_factor", 'width'"width""width""width""width"

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

The calculated features.

Example (HDevelop)

read_image(Image,'monkey')
threshold(Image,S1,160,255)
connection(S1,S2)
region_features(S2,['area','anisometry'],Value)

Result

The operator region_featuresregion_featuresRegionFeaturesRegionFeaturesregion_features returns the value 2 ( H_MSG_TRUE) if the input is not empty. If necessary an exception is raised.

Possible Predecessors

thresholdthresholdThresholdThresholdthreshold, regiongrowingregiongrowingRegiongrowingRegiongrowingregiongrowing, connectionconnectionConnectionConnectionconnection, runlength_featuresrunlength_featuresRunlengthFeaturesRunlengthFeaturesrunlength_features

Possible Successors

select_shapeselect_shapeSelectShapeSelectShapeselect_shape, select_grayselect_graySelectGraySelectGrayselect_gray, shape_transshape_transShapeTransShapeTransshape_trans, reduce_domainreduce_domainReduceDomainReduceDomainreduce_domain, count_objcount_objCountObjCountObjcount_obj

See also

area_centerarea_centerAreaCenterAreaCenterarea_center, circularitycircularityCircularityCircularitycircularity, compactnesscompactnessCompactnessCompactnesscompactness, contlengthcontlengthContlengthContlengthcontlength, convexityconvexityConvexityConvexityconvexity, rectangularityrectangularityRectangularityRectangularityrectangularity, elliptic_axiselliptic_axisEllipticAxisEllipticAxiselliptic_axis, eccentricityeccentricityEccentricityEccentricityeccentricity, inner_circleinner_circleInnerCircleInnerCircleinner_circle, smallest_circlesmallest_circleSmallestCircleSmallestCirclesmallest_circle, smallest_rectangle1smallest_rectangle1SmallestRectangle1SmallestRectangle1smallest_rectangle1, smallest_rectangle2smallest_rectangle2SmallestRectangle2SmallestRectangle2smallest_rectangle2, inner_rectangle1inner_rectangle1InnerRectangle1InnerRectangle1inner_rectangle1, roundnessroundnessRoundnessRoundnessroundness, connect_and_holesconnect_and_holesConnectAndHolesConnectAndHolesconnect_and_holes, area_holesarea_holesAreaHolesAreaHolesarea_holes, diameter_regiondiameter_regionDiameterRegionDiameterRegiondiameter_region, orientation_regionorientation_regionOrientationRegionOrientationRegionorientation_region, moments_region_2ndmoments_region_2ndMomentsRegion2ndMomentsRegion2ndmoments_region_2nd, moments_region_2nd_invarmoments_region_2nd_invarMomentsRegion2ndInvarMomentsRegion2ndInvarmoments_region_2nd_invar, moments_region_2nd_rel_invarmoments_region_2nd_rel_invarMomentsRegion2ndRelInvarMomentsRegion2ndRelInvarmoments_region_2nd_rel_invar, moments_region_3rdmoments_region_3rdMomentsRegion3rdMomentsRegion3rdmoments_region_3rd, moments_region_3rd_invarmoments_region_3rd_invarMomentsRegion3rdInvarMomentsRegion3rdInvarmoments_region_3rd_invar, moments_region_centralmoments_region_centralMomentsRegionCentralMomentsRegionCentralmoments_region_central, moments_region_central_invarmoments_region_central_invarMomentsRegionCentralInvarMomentsRegionCentralInvarmoments_region_central_invar, select_objselect_objSelectObjSelectObjselect_obj, select_shapeselect_shapeSelectShapeSelectShapeselect_shape

Module

Foundation