select_shape🔗
説明🔗
select_shape — 形状特徴量に基づいて領域を選択する。
書式🔗
select_shape( region Regions, out region SelectedRegions, string Features, string Operation, real Min, real Max )
説明🔗
オペレーター select_shape は、形状特徴量に基づいて領域を選
択します。
Regions から得られる各入力領域に対し、指定した特徴量(
Features)が計算されます。
計算された特徴の全て(Operation = 'and')または少なくと
も 1 つ (Operation = 'or') が限界値 (Min,
Max) の範囲内にある領域が選択され出力されます。
パラメータMin と Max を'min' または 'max'へ設定でき、
それぞれ上限と下限を無制限にすることができます。
条件: \(Min_{i} \leq Feature_{i}(Object) \leq Max_{i}\)
それぞれの特徴量のイメージ図はこの章(Regions / Features)の ドキュメントをご参照ください。
Features: の可能な値は以下のとおりです。
-
'area': オブジェクトの面積
-
'row': 中心の行座標
-
'column': 中心の列座標
-
'width': 座標軸に平行な領域の幅(
height_width_ratioを参照) -
'height': 座標軸に平行な領域の高さ(
height_width_ratioを参照) -
'ratio': 座標軸に平行な領域の高さと幅の比率 (
height_width_ratioを参照) -
'row1': 左上隅の行座標
-
'column1': 左上隅の列座標
-
'row2': 右下隅の行座標
-
'column2': 右下隅の列座標
-
'circularity': 真円度(
circularityを参照) -
'compactness': コンパクト性(
compactnessを参 照) -
'contlength': 輪郭の全長 (オペレーター
contlengthを参照) -
'convexity': 凸面度(
convexityを参照) -
'rectangularity': 長方形度合い(
rectangularityを参 照) -
'ra': 楕円近似の長軸の半径 (
elliptic_axisを参照) -
'rb': 楕円近似の短軸の半径(
elliptic_axisを参照) -
'phi': 楕円近似の方向(
elliptic_axisを 参照) -
'anisometry': 形状特性(
eccentricityを参照) -
'bulkiness': かさばり(オペレーター
eccentricityを参照) -
'struct_factor': 構造係数(オペレーター
eccentricityを参照) -
'outer_radius': 領域を囲む最小円の半径(
smallest_circleを参照) -
'inner_radius': 最大内接円の半径(
inner_circleを 参照) -
'inner_width': 領域に適合する軸に平行な最大矩形の幅(
inner_rectangle1を参照) -
'inner_height': 領域に適合する軸に平行な最大矩形の高さ (
inner_rectangle1を参照) -
'dist_mean': 領域境界から中心までの平均距離 (オペレー ター
roundnessを参照) -
'dist_deviation': 領域境界の中心からの距離の偏差 (オペレー ター
roundnessを参照) -
'roundness': 丸み(オペレーター
roundnessを参 照) -
'num_sides': 多角形の辺数(オペレーター
roundnessを参照) -
'connect_num': 連結要素の数(オペレーター
connect_and_holesを参照) -
'holes_num': ホール(穴)の数(オペレーター
connect_and_holesを参照) -
'area_holes': オブジェクトのホール(穴)の面積 (オペレーター
area_holesを参照) -
'max_diameter': 領域の最大直径(オペレーター
diameter_regionを参照) -
'orientation': 領域の方向(オペレーター
orientation_regionを参照) -
'euler_number': オイラー数(オペレーター
euler_numberを参照) -
'rect2_phi': 領域を囲む最小矩形の方向 (オペレーター
smallest_rectangle2を参照) -
'rect2_len1': 領域を囲む最小矩形の長さの半分 (オペレー ター
smallest_rectangle2を参照) -
'rect2_len2': 領域を囲む最小矩形の幅の半分 (オペレー ター
smallest_rectangle2を参照) -
'moments_m11': 領域の幾何学モーメント (オペレーター
moments_region_2ndを参照) -
'moments_m20': 領域の幾何学モーメント (オペレーター
moments_region_2ndを参照) -
'moments_m02': 領域の幾何学モーメント (オペレーター
moments_region_2ndを参照) -
'moments_ia': 領域の幾何学モーメント (オペレーター
moments_region_2ndを参照) -
'moments_ib': 領域の幾何学モーメント (オペレーター
moments_region_2ndを参照) -
'moments_m11_invar': 領域の幾何学モーメント (オペレーター
moments_region_2nd_invarを参 照) -
'moments_m20_invar': 領域の幾何学モーメント (オペレーター
moments_region_2nd_invarを参 照) -
'moments_m02_invar': 領域の幾何学モーメント (オペレーター
moments_region_2nd_invarを参 照) -
'moments_phi1': 領域の幾何学モーメント (オペレーター
moments_region_2nd_rel_invarを 参照) -
'moments_phi2': 領域の幾何学モーメント (オペレーター
moments_region_2nd_rel_invarを 参照) -
'moments_m21': 領域の幾何学モーメント (オペレーター
moments_region_3rdを参照) -
'moments_m12': 領域の幾何学モーメント (オペレーター
moments_region_3rdを参照) -
'moments_m03': 領域の幾何学モーメント (オペレーター
moments_region_3rdを参照) -
'moments_m30': 領域の幾何学モーメント (オペレーター
moments_region_3rdを参照) -
'moments_m21_invar': 領域の幾何学モーメント (オペレーター
moments_region_3rd_invarを参 照) -
'moments_m12_invar': 領域の幾何学モーメント (オペレーター
moments_region_3rd_invarを参 照) -
'moments_m03_invar': 領域の幾何学モーメント (オペレーター
moments_region_3rd_invarを参 照) -
'moments_m30_invar': 領域の幾何学モーメント (オペレーター
moments_region_3rd_invarを参 照) -
'moments_i1': 領域の幾何学モーメント (オペレーター
moments_region_centralを参 照) -
'moments_i2': 領域の幾何学モーメント (オペレーター
moments_region_centralを参 照) -
'moments_i3': 領域の幾何学モーメント (オペレーター
moments_region_centralを参 照) -
'moments_i4': 領域の幾何学モーメント (オペレーター
moments_region_centralを参 照) -
'moments_psi1': 領域の幾何学モーメント (オペレーター
moments_region_central_invarを 参照) -
'moments_psi2': 領域の幾何学モーメント (オペレーター
moments_region_central_invarを 参照) -
'moments_psi3': 領域の幾何学モーメント (オペレーター
moments_region_central_invarを 参照) -
'moments_psi4': 領域の幾何学モーメント (オペレーター
moments_region_central_invarを 参照)
ただ 1 つの特徴(Features)が使用される場合、
Operation の値は意味がありません。複数の特徴を選ぶ場合、
入力された順番で処理されます。
実行情報🔗
実行情報
-
マルチスレッドタイプ: リエントラント(非排他なオペレーターと並列に動作)
-
マルチスレッドスコープ: グローバル(他のスレッドから呼び出される可能性あり)
-
tupleレベルで自動的に並列演算処理を実施
パラメーター🔗
Regions (input_object) region-array → object
対象となる領域
SelectedRegions (output_object) region-array → object
結果として選択された領域
Features (input_control) string(-array) → (string)
チェックする形状特徴
初期値: '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'
Operation (input_control) string → (string)
個々の特徴の組み合わせ方法
初期値: 'and'
値のリスト: 'and', 'or'
Min (input_control) real(-array) → (real / integer / string)
特徴の下限値もしくは ‘min’
初期値: 150.0
値域: 0.0 ≤ Min ≤ 99999.0
最小増分: 0.001
推奨増分: 1.0
Max (input_control) real(-array) → (real / integer / string)
特徴の上限値もしくは ‘max’
初期値: 99999.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_shape は、値 2 (H_MSG_TRUE)
を返します。入力が空の場合(入力オブジェクトが得られない)の動作
は、オペレーター set_system('no_object_result',<Result>)
を通して設定されます。
空の領域の場合(領域が空集合である場合)の動作は、オペレーター
set_system('empty_region_result',<Result>) を通して設定さ れます。
必要に応じて、例外が発生します。
他のオペレーターとの組み合わせ🔗
組み合わせ
前処理の候補
threshold, regiongrowing, connection, runlength_features
後処理の候補
select_gray, shape_trans, reduce_domain, count_obj
他の選択候補
関連項目
area_center, circularity, compactness, contlength, convexity, rectangularity, elliptic_axis, eccentricity, inner_circle, smallest_circle, smallest_rectangle1, smallest_rectangle2, inner_rectangle1, roundness, connect_and_holes, area_holes, diameter_region, orientation_region, moments_region_2nd, moments_region_2nd_invar, moments_region_2nd_rel_invar, moments_region_3rd, moments_region_3rd_invar, moments_region_central, moments_region_central_invar, select_obj
モジュール🔗
Foundation