Skip to content

select_shapeSelectShapeSelectShapeselect_shapeselect_shape🔗

説明🔗

select_shapeSelectShapeSelectShapeselect_shapeselect_shape — 形状特徴量に基づいて領域を選択する。

書式🔗

select_shape( region Regions, out region SelectedRegions, string Features, string Operation, real Min, real Max )void SelectShape( const HObject& Regions, HObject* SelectedRegions, const HTuple& Features, const HTuple& Operation, const HTuple& Min, const HTuple& Max )static void HOperatorSet.SelectShape( HObject regions, out HObject selectedRegions, HTuple features, HTuple operation, HTuple min, HTuple max )def select_shape( regions: HObject, features: MaybeSequence[str], operation: str, min: MaybeSequence[Union[int, float, str]], max: MaybeSequence[Union[int, float, str]] ) -> HObject

Herror select_shape( const Hobject Regions, Hobject* SelectedRegions, const char* Features, const char* Operation, double Min, double Max )

Herror T_select_shape( const Hobject Regions, Hobject* SelectedRegions, const Htuple Features, const Htuple Operation, const Htuple Min, const Htuple Max )

HRegion HRegion::SelectShape( const HTuple& Features, const HString& Operation, const HTuple& Min, const HTuple& Max ) const

HRegion HRegion::SelectShape( const HString& Features, const HString& Operation, double Min, double Max ) const

HRegion HRegion::SelectShape( const char* Features, const char* Operation, double Min, double Max ) const

HRegion HRegion::SelectShape( const wchar_t* Features, const wchar_t* Operation, double Min, double Max ) const (Windows only)

HRegion HRegion.SelectShape( HTuple features, string operation, HTuple min, HTuple max )

HRegion HRegion.SelectShape( string features, string operation, double min, double max )

説明🔗

オペレーター select_shapeSelectShape は、形状特徴量に基づいて領域を選 択します。 Regionsregionsregions から得られる各入力領域に対し、指定した特徴量( Featuresfeaturesfeatures)が計算されます。 計算された特徴の全て(Operationoperationoperation = 'and'"and")または少なくと も 1 つ (Operationoperationoperation = 'or'"or") が限界値 (Minminmin, Maxmaxmax) の範囲内にある領域が選択され出力されます。 パラメータMinminmin と Maxmaxmax を'min'"min" または 'max'"max"へ設定でき、 それぞれ上限と下限を無制限にすることができます。

条件: \(Min_{i} \leq Feature_{i}(Object) \leq Max_{i}\)

それぞれの特徴量のイメージ図はこの章(Regions / Features)の ドキュメントをご参照ください。

Featuresfeaturesfeatures: の可能な値は以下のとおりです。

ただ 1 つの特徴(Featuresfeaturesfeatures)が使用される場合、 Operationoperationoperation の値は意味がありません。複数の特徴を選ぶ場合、 入力された順番で処理されます。

実行情報🔗

実行情報
  • マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)

  • マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)

  • tupleレベルで自動的に並列演算処理を実施

パラメーター🔗

Regionsregionsregions (input_object) region-array → objectHObjectHRegionHObjectHobject

対象となる領域

SelectedRegionsselectedRegionsselected_regions (output_object) region-array → objectHObjectHRegionHObjectHobject *

結果として選択された領域

Featuresfeaturesfeatures (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

チェックする形状特徴

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

Operationoperationoperation (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

個々の特徴の組み合わせ方法

初期値: 'and'"and"
値のリスト: 'and', 'or'"and", "or"

Minminmin (input_control) real(-array) → (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)MaybeSequence[Union[int, float, str]]Htuple (double / Hlong / char*)

特徴の下限値もしくは ‘min’

初期値: 150.0150.0
値域: 0.0 ≤ Min ≤ 99999.0
最小増分: 0.001
推奨増分: 1.0

Maxmaxmax (input_control) real(-array) → (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)MaybeSequence[Union[int, float, str]]Htuple (double / Hlong / char*)

特徴の上限値もしくは ‘max’

初期値: 99999.099999.0
値域: 0.0 ≤ Max ≤ 99999.0
最小増分: 0.001
推奨増分: 1.0
制限: Max >= Min

例🔗

(HDevelop)


* Where are the eyes of the Mandrill?
read_image(Image,'monkey')
threshold(Image,Region,128,255)
connection(Region,ConnectedRegions)
select_shape(ConnectedRegions,Eyes,['area','max_diameter'],\
             'and',[500,30.0],[1000,50.0])
dev_display(Eyes)
(C)
/* Where are the eyes of the Mandrill? */
read_image(&Image,"monkey")\;
threshold(Image,&Region,128.0,255.0)\;
connection(Region,&ConnectedRegions)\;
select_shape(ConnectedRegions,&SelectedRegions,"area","and",500.0,1000.0)\;
select_shape(SelectedRegions,&Eyes,"max_diameter","and",30.0,50.0)\;
disp_region(Eyes,WindowHandle)\;

結果🔗

入力が空でない場合、オペレーター select_shapeSelectShape は、値 2 (H_MSG_TRUE) を返します。入力が空の場合(入力オブジェクトが得られない)の動作 は、オペレーター set_system('no_object_result',<Result>) を通して設定されます。 空の領域の場合(領域が空集合である場合)の動作は、オペレーター set_system('empty_region_result',<Result>) を通して設定さ れます。 必要に応じて、例外が発生します。

他のオペレーターとの組み合わせ🔗

組み合わせ

前処理の候補

thresholdThreshold, regiongrowingRegiongrowing, connectionConnection, runlength_featuresRunlengthFeatures

後処理の候補

select_graySelectGray, shape_transShapeTrans, reduce_domainReduceDomain, count_objCountObj

他の選択候補

select_shape_stdSelectShapeStd

関連項目

area_centerAreaCenter, circularityCircularity, compactnessCompactness, contlengthContlength, convexityConvexity, rectangularityRectangularity, elliptic_axisEllipticAxis, eccentricityEccentricity, inner_circleInnerCircle, smallest_circleSmallestCircle, smallest_rectangle1SmallestRectangle1, smallest_rectangle2SmallestRectangle2, inner_rectangle1InnerRectangle1, roundnessRoundness, connect_and_holesConnectAndHoles, area_holesAreaHoles, diameter_regionDiameterRegion, orientation_regionOrientationRegion, moments_region_2ndMomentsRegion2nd, moments_region_2nd_invarMomentsRegion2ndInvar, moments_region_2nd_rel_invarMomentsRegion2ndRelInvar, moments_region_3rdMomentsRegion3rd, moments_region_3rd_invarMomentsRegion3rdInvar, moments_region_centralMomentsRegionCentral, moments_region_central_invarMomentsRegionCentralInvar, select_objSelectObj

モジュール🔗

Foundation