Skip to content

find_component_modelFindComponentModelFindComponentModelfind_component_modelT_find_component_model🔗

説明🔗

find_component_modelFindComponentModelFindComponentModelfind_component_modelT_find_component_model — 画像中で最も部品モデルに一致するものを検出する。

警告🔗

find_component_modelFindComponentModelは現在では使用されず、下位互換性のためだけに提供されます。 このオペレータはHALCON 26.11で削除予定です。

書式🔗

find_component_model( image Image, component_model ComponentModelID, integer RootComponent, angle.rad AngleStartRoot, angle.rad AngleExtentRoot, real MinScore, integer NumMatches, real MaxOverlap, string IfRootNotFound, string IfComponentNotFound, string PosePrediction, real MinScoreComp, string SubPixelComp, integer NumLevelsComp, real GreedinessComp, out integer ModelStart, out integer ModelEnd, out real Score, out point.y RowComp, out point.x ColumnComp, out angle.rad AngleComp, out real ScoreComp, out integer ModelComp )void FindComponentModel( const HObject& Image, const HTuple& ComponentModelID, const HTuple& RootComponent, const HTuple& AngleStartRoot, const HTuple& AngleExtentRoot, const HTuple& MinScore, const HTuple& NumMatches, const HTuple& MaxOverlap, const HTuple& IfRootNotFound, const HTuple& IfComponentNotFound, const HTuple& PosePrediction, const HTuple& MinScoreComp, const HTuple& SubPixelComp, const HTuple& NumLevelsComp, const HTuple& GreedinessComp, HTuple* ModelStart, HTuple* ModelEnd, HTuple* Score, HTuple* RowComp, HTuple* ColumnComp, HTuple* AngleComp, HTuple* ScoreComp, HTuple* ModelComp )static void HOperatorSet.FindComponentModel( HObject image, HTuple componentModelID, HTuple rootComponent, HTuple angleStartRoot, HTuple angleExtentRoot, HTuple minScore, HTuple numMatches, HTuple maxOverlap, HTuple ifRootNotFound, HTuple ifComponentNotFound, HTuple posePrediction, HTuple minScoreComp, HTuple subPixelComp, HTuple numLevelsComp, HTuple greedinessComp, out HTuple modelStart, out HTuple modelEnd, out HTuple score, out HTuple rowComp, out HTuple columnComp, out HTuple angleComp, out HTuple scoreComp, out HTuple modelComp )def find_component_model( image: HObject, component_model_id: HHandle, root_component: MaybeSequence[int], angle_start_root: MaybeSequence[float], angle_extent_root: MaybeSequence[float], min_score: float, num_matches: int, max_overlap: float, if_root_not_found: str, if_component_not_found: str, pose_prediction: str, min_score_comp: MaybeSequence[float], sub_pixel_comp: MaybeSequence[str], num_levels_comp: MaybeSequence[int], greediness_comp: MaybeSequence[float] ) -> Tuple[Sequence[int], Sequence[int], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[int]]

def find_component_model_s( image: HObject, component_model_id: HHandle, root_component: MaybeSequence[int], angle_start_root: MaybeSequence[float], angle_extent_root: MaybeSequence[float], min_score: float, num_matches: int, max_overlap: float, if_root_not_found: str, if_component_not_found: str, pose_prediction: str, min_score_comp: MaybeSequence[float], sub_pixel_comp: MaybeSequence[str], num_levels_comp: MaybeSequence[int], greediness_comp: MaybeSequence[float] ) -> Tuple[int, int, float, float, float, float, float, int]Herror T_find_component_model( const Hobject Image, const Htuple ComponentModelID, const Htuple RootComponent, const Htuple AngleStartRoot, const Htuple AngleExtentRoot, const Htuple MinScore, const Htuple NumMatches, const Htuple MaxOverlap, const Htuple IfRootNotFound, const Htuple IfComponentNotFound, const Htuple PosePrediction, const Htuple MinScoreComp, const Htuple SubPixelComp, const Htuple NumLevelsComp, const Htuple GreedinessComp, Htuple* ModelStart, Htuple* ModelEnd, Htuple* Score, Htuple* RowComp, Htuple* ColumnComp, Htuple* AngleComp, Htuple* ScoreComp, Htuple* ModelComp )

HTuple HComponentModel::FindComponentModel( const HImage& Image, const HTuple& RootComponent, const HTuple& AngleStartRoot, const HTuple& AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& IfRootNotFound, const HString& IfComponentNotFound, const HString& PosePrediction, const HTuple& MinScoreComp, const HTuple& SubPixelComp, const HTuple& NumLevelsComp, const HTuple& GreedinessComp, HTuple* ModelEnd, HTuple* Score, HTuple* RowComp, HTuple* ColumnComp, HTuple* AngleComp, HTuple* ScoreComp, HTuple* ModelComp ) const

Hlong HComponentModel::FindComponentModel( const HImage& Image, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& IfRootNotFound, const HString& IfComponentNotFound, const HString& PosePrediction, double MinScoreComp, const HString& SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp ) const

Hlong HComponentModel::FindComponentModel( const HImage& Image, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const char* IfRootNotFound, const char* IfComponentNotFound, const char* PosePrediction, double MinScoreComp, const char* SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp ) const

Hlong HComponentModel::FindComponentModel( const HImage& Image, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const wchar_t* IfRootNotFound, const wchar_t* IfComponentNotFound, const wchar_t* PosePrediction, double MinScoreComp, const wchar_t* SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp ) const (Windows only)

HTuple HImage::FindComponentModel( const HComponentModel& ComponentModelID, const HTuple& RootComponent, const HTuple& AngleStartRoot, const HTuple& AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& IfRootNotFound, const HString& IfComponentNotFound, const HString& PosePrediction, const HTuple& MinScoreComp, const HTuple& SubPixelComp, const HTuple& NumLevelsComp, const HTuple& GreedinessComp, HTuple* ModelEnd, HTuple* Score, HTuple* RowComp, HTuple* ColumnComp, HTuple* AngleComp, HTuple* ScoreComp, HTuple* ModelComp ) const

Hlong HImage::FindComponentModel( const HComponentModel& ComponentModelID, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const HString& IfRootNotFound, const HString& IfComponentNotFound, const HString& PosePrediction, double MinScoreComp, const HString& SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp ) const

Hlong HImage::FindComponentModel( const HComponentModel& ComponentModelID, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const char* IfRootNotFound, const char* IfComponentNotFound, const char* PosePrediction, double MinScoreComp, const char* SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp ) const

Hlong HImage::FindComponentModel( const HComponentModel& ComponentModelID, Hlong RootComponent, double AngleStartRoot, double AngleExtentRoot, double MinScore, Hlong NumMatches, double MaxOverlap, const wchar_t* IfRootNotFound, const wchar_t* IfComponentNotFound, const wchar_t* PosePrediction, double MinScoreComp, const wchar_t* SubPixelComp, Hlong NumLevelsComp, double GreedinessComp, Hlong* ModelEnd, double* Score, double* RowComp, double* ColumnComp, double* AngleComp, double* ScoreComp, Hlong* ModelComp ) const (Windows only)

HTuple HComponentModel.FindComponentModel( HImage image, HTuple rootComponent, HTuple angleStartRoot, HTuple angleExtentRoot, double minScore, int numMatches, double maxOverlap, string ifRootNotFound, string ifComponentNotFound, string posePrediction, HTuple minScoreComp, HTuple subPixelComp, HTuple numLevelsComp, HTuple greedinessComp, out HTuple modelEnd, out HTuple score, out HTuple rowComp, out HTuple columnComp, out HTuple angleComp, out HTuple scoreComp, out HTuple modelComp )

int HComponentModel.FindComponentModel( HImage image, int rootComponent, double angleStartRoot, double angleExtentRoot, double minScore, int numMatches, double maxOverlap, string ifRootNotFound, string ifComponentNotFound, string posePrediction, double minScoreComp, string subPixelComp, int numLevelsComp, double greedinessComp, out int modelEnd, out double score, out double rowComp, out double columnComp, out double angleComp, out double scoreComp, out int modelComp )

HTuple HImage.FindComponentModel( HComponentModel componentModelID, HTuple rootComponent, HTuple angleStartRoot, HTuple angleExtentRoot, double minScore, int numMatches, double maxOverlap, string ifRootNotFound, string ifComponentNotFound, string posePrediction, HTuple minScoreComp, HTuple subPixelComp, HTuple numLevelsComp, HTuple greedinessComp, out HTuple modelEnd, out HTuple score, out HTuple rowComp, out HTuple columnComp, out HTuple angleComp, out HTuple scoreComp, out HTuple modelComp )

int HImage.FindComponentModel( HComponentModel componentModelID, int rootComponent, double angleStartRoot, double angleExtentRoot, double minScore, int numMatches, double maxOverlap, string ifRootNotFound, string ifComponentNotFound, string posePrediction, double minScoreComp, string subPixelComp, int numLevelsComp, double greedinessComp, out int modelEnd, out double score, out double rowComp, out double columnComp, out double angleComp, out double scoreComp, out int modelComp )

説明🔗

オペレーター find_component_modelFindComponentModel は、入力画像 Imageimageimage から部品モデル ComponentModelIDcomponentModelIDcomponent_model_id の最適な NumMatchesnumMatchesnum_matches 個のインスタンスを検出します。

検索の結果は、get_found_component_modelGetFoundComponentModelを使用して 視覚化できます。 また、このオペレーターでは、特定のモデルコンポーネントインスタンスに 一致するコンポーネントを抽出することもできます。

入力パラメーターの詳細🔗

  • ComponentModelIDcomponentModelIDcomponent_model_id: 部品モデルのハンドル。

    create_trained_component_modelCreateTrainedComponentModel、 create_component_modelCreateComponentModel を事前に呼び出しモデルを作成しておく、 またはread_component_modelReadComponentModel を実行し、モデルを読み込んでおく 必要があります。

  • RootComponentrootComponentroot_component: ルートの部品のインデックス。

    部品モデル ComponentModelIDcomponentModelIDcomponent_model_id の部品は、ツリー構造で表現さ れます。 探索ツリーのルートに位置している部品は、ルート部品です。

    ルート部品は、 すべての探索領域、例えば許容されるすべての位置、方向範囲(以下を参照) で探索されます。 これに対し、残りの部品は、関係から計算された絞り込 まれた探索領域内で、探索ツリーにおける親の姿勢に関連した領域で探索 されます。(再帰検索)

    いくつかの要素により、モデルの部品が探索ツリーでどのよ うになるのかを適合します。原則として、画像内で高い確率で見つけられ るモデルの部品を選択してください。したがって、回転によって隠れが起 こったり、消失が度々起きたりするような部品は、ルートの部品として適してい ません。 このようなケースでの挙動については 以下の IfRootNotFoundifRootNotFoundif_root_not_foundを見てください。

    別の可能な基準は、検索中にルートコンポーネントに関連付けられる計算時間です。 後者の基準をもとにしたモデルの部品のランキングが、オペ レーター create_trained_component_modelCreateTrainedComponentModel または create_component_modelCreateComponentModel のそれぞれの RootRankingrootRankingroot_ranking に返されます。 もし完全なランキングが RootComponentrootComponentroot_component に渡さ れた場合、最初の値 RootComponentrootComponentroot_component[0] が自動的にルートの部 品として選択されます。

  • AngleStartRootangleStartRootangle_start_root and AngleExtentRootangleExtentRootangle_extent_root: ルート部品が検索される許容角度範囲([rad]単位)を指定します。

    必要ならば、回転範囲は、 部品モデルを create_trained_component_modelCreateTrainedComponentModel または create_component_modelCreateComponentModel で生成した際に与えられた角度の範囲 内でさらに切り取られます。 各部品のための角度範囲は、get_shape_model_paramsGetShapeModelParams で確かめることが できます。 対応する形状モデルの必要なハンドルは、get_component_model_paramsGetComponentModelParamsを 使用して取得できます。

  • MinScoreminScoremin_score: マッチングした対象が、少なくとも画像中の部品モデルとしてみなせるスコアを決定します。

    もし部品モデルが画像中でまったく隠れがないとみなせるならば、MinScoreminScoremin_score は 0.80.8 や 0.90.9 といった高い値に設定できます。 このパラメーターの値は、計算時間にわずかな影響しか与えません。 例外は、IfRootNotFoundifRootNotFoundif_root_not_foundが'select_new_root'"select_new_root"に設定されている場合です (以下を参照)。

  • NumMatchesnumMatchesnum_matches: 返されるインスタンスの最大数を決定します。

    NumMatchesnumMatchesnum_matches より少ない個数が検出された場合は、その数だけが 返されます。つまり、パラメーター MinScoreminScoremin_score は NumMatchesnumMatchesnum_matches より優先されます。 MinScoreminScoremin_score より高いスコアのモデルがNumMatchesnumMatchesnum_matches で指定した 個数より多く検出された場合は、スコアの高い順番から NumMatchesnumMatchesnum_matches で指定した 個数だけが返されます。 画像中の MinScoreminScoremin_score を超えるすべてのモデルインスタンスを検索する場合は、 NumMatchesnumMatchesnum_matches を 00に設定する必要があります。

  • MaxOverlapmaxOverlapmax_overlap: 2つのインスタンスが最大でどの程度の割合でオーバーラップすることを許容するかを決定します。 この割合は0〜1の数値になります。

    場合によっては、見つかったインスタンスは 1 つまたは 2、3 の部品の 姿勢の中で重なっていることがあります。 2 つのモデルが互いに MaxOverlapmaxOverlapmax_overlap で指定した割合より重なり あっていた場合はスコアの高いモデルのみが返されます。 これはつまり、MaxOverlapmaxOverlapmax_overlap \(=\) 00 の場合、見つかったインスタンス はまったく重なっていない可能性がありますが、MaxOverlapmaxOverlapmax_overlap &=& 11 の場合、重なりに対するチェックは行われず、すべてのインスタンスが返されます。 この重なりの計算は、検出部品のインスタンスの任意の方向を持つ最小矩形 (smallest_rectangle2SmallestRectangle2 を参照)に基づきます。

  • IfRootNotFoundifRootNotFoundif_root_not_found: ルート部品に消失や隠れが起きた際の、オペレーターの動作を決定します。

    パラメーター値:

    • 'stop_search'"stop_search": ルート部品が画像中に常にあると仮定します。 したがって、ルート部品が見つからなかった際に、他の部品を探索することはありません。

    • 'select_new_root'"select_new_root": 続けて違う他の部品をルート部品として選択し、探索領域全体を探索します。 ルート部品の選択の順番は、渡された RootRankingrootRankingroot_ranking の順番に対応して 実行されます。 すべてのルートの部品が見つかった姿勢は、残りの部品を 再び探索し始めるために使用されます。したがって、オリジナルのルートの部 品が見つからなくても、モデルを探索することが可能です。ただし、探索 の実行時間は、'stop_search'"stop_search" を選択した際の実行時間 と比較して増加します。 より多くのルート部品を検索する必要があると、 MinScoreminScoremin_scoreの値が小さい場合に特に当てはまるようになります。 もし探索中により多くのルート部品が RootComponentrootComponentroot_component して必要とされる場合、 ルートの部品は自動的に計算された順序で完了します(create_trained_component_modelCreateTrainedComponentModel または create_component_modelCreateComponentModel を参照してください)。

  • IfComponentNotFoundifComponentNotFoundif_component_not_found: ルート以外の部品が消失や隠れによって見つからなかった場合の、オペレーターの動作を指定し ます。

    パラメーター値:

    • 'prune_branch'"prune_branch": そのような部品はまったく見つけることができず、また ‘not found’ として 扱われます。

    • 'search_from_upper'"search_from_upper": そのような部品は親の部品の姿勢との関係で探索されます。

    • 'search_from_best'"search_from_best": そのような部品は最小の計算量で探索が実行できる、すでに見つかった部品の姿勢との 関係で探索されます。

  • PosePredictionposePredictionpose_prediction: 見つけることのできない部品の姿勢を推定するかどうかを決定します。.

    パラメーター値:

    • 'none'"none": 見つかった部品の姿勢のみが返されます。

    • 'from_neighbors'"from_neighbors": 見つからないコンポーネントのポーズは推定され、 ScoreCompscoreCompscore_comp \(=\) 0.00.0のスコアで返されます。 姿勢の推定は、探索ツリーにおいて隣接する見つかった部品の姿勢に 基づいています。

    • 'from_all'"from_all": 見つからないコンポーネントのポーズは推定され、 ScoreCompscoreCompscore_comp \(=\) 0.00.0のスコアで返されます。 姿勢推定は、見つかったすべてのコンポーネントの姿勢に基づいています。

  • MinScoreCompminScoreCompmin_score_comp: インスタンスを見つけるために必要なコンポーネントの最小スコア。

    このパラメータは、find_shape_modelFindShapeModelのMinScoreminScoremin_scoreと 同じ意味です。

    1つの要素か、ComponentModelIDcomponentModelIDcomponent_model_idのモデルコンポーネントと同じ要素数を設定できます。 最初のケースでは、パラメーターはすべてのコンポーネントに使用されます。 2番目のケースでは、各パラメーター要素はComponentModelIDcomponentModelIDcomponent_model_idの対応するコンポーネントを参照します。

  • SubPixelCompsubPixelCompsub_pixel_comp: 抽出をサブピクセル精度で行うかどうかを決定し、 オブジェクトの最大許容変形が指定された場合はピクセル単位を指定します。

    このパラメータは、find_shape_modelFindShapeModelのSubPixelsubPixelsub_pixelと同じ意味です。 したがって、最大許容オブジェクト変形は、同じ文字列内の整数として指定する 必要があります。 1つの要素か、ComponentModelIDcomponentModelIDcomponent_model_idのモデルコンポーネントと同じ要素数を設定できます。 最初のケースでは、パラメーターはすべてのコンポーネントに使用されます。 2番目のケースでは、各パラメーター要素は ComponentModelIDcomponentModelIDcomponent_model_idの対応するコンポーネントを参照します。

    例: ['least_squares', 'max_deformation 2']["least_squares", "max_deformation 2"].

  • NumLevelsCompnumLevelsCompnum_levels_comp:

    マッチングで使用されるコンポーネントのピラミッドレベルを決定します。

    このパラメータは、find_shape_modelFindShapeModelの NumLevelsnumLevelsnum_levelsと同じ意味です。

    マッチングで使用されるコンポーネントのピラミッドレベルの数を決定します。 1つの要素か、ComponentModelIDcomponentModelIDcomponent_model_idのモデルコンポーネントと同じ要素数を設定できます。 最初のケースでは、パラメーターはすべてのコンポーネントに使用されます。 2番目のケースでは、各パラメーター要素はComponentModelIDcomponentModelIDcomponent_model_idの対応するコンポーネントを参照します。

    オプションで、このパラメーターの値のペアを設定できます。 この場合、最初の値は、使用するピラミッドレベルの数を決定します。 2番目の値は、見つかった一致が追跡される最も低いピラミッドレベルを指定します。 その際、単一の値ペアまたはComponentModelIDcomponentModelIDcomponent_model_idでモデルコンポーネントごとに値ペアを設定できます。 異なるコンポーネントに異なる値のペアを使用する必要がある場合は、同じ要素数で指定する必要があります。 ComponentModelIDcomponentModelIDcomponent_model_idに2つのコンポーネントが含まれていて、 NumLevelsCompnumLevelsCompnum_levels_compに2つの値が設定されている場合、これらの値は、 値のペアとしてではなく、異なる使用されるピラミッドレベルの数として解釈されます。

    例: ComponentModelIDcomponentModelIDcomponent_model_idは2つのコンポーネントが含まれており、 異なるピラミッドレベルが考慮されている。 最初のコンポーネントには、レベル2までの5レベルが使用される。 2番目のコンポーネントには、レベル1までの4つのレベルが使用される。 この場合、NumLevelsCompnumLevelsCompnum_levels_comp \(=\) [5, 2, 4, 1][5, 2, 4, 1]です。

  • GreedinessCompgreedinessCompgreediness_comp: コンポーネントのヒューリスティック検索における“Greediness”値:0から1までの値で、 0:安全であるが遅い、1:速いが一致しない場合があることを意味します。

    このパラメータは、find_shape_modelFindShapeModelのGreedinessgreedinessgreedinessと同じ意味です。

    1つの要素か、ComponentModelIDcomponentModelIDcomponent_model_idのモデルコンポーネントと同じ要素数を設定できます。 最初のケースでは、パラメーターはすべてのコンポーネントに使用されます。 2番目のケースでは、各パラメーター要素はComponentModelIDcomponentModelIDcomponent_model_idの対応するコンポーネントを参照します。

出力パラメーターの詳細🔗

ワーク探索に関する情報🔗

内部的に、形状ベースマッチングは個々の部品を探索するために部品ベー スマッチングでも使用されます(find_shape_modelFindShapeModel を参照)。

Imageimageimageのドメインは、ルートコンポーネントの参照点の 検索スペース、つまり許可される位置を決定します。

通常、モデルコンポーネントは、モデルが画像内に完全に含まれるような 画像のドメインのポイント内でのみ検索されます。 これは、スコアが MinScoreCompminScoreCompmin_score_comp (上記を参照)より大き い場合でも、部品が画像の境界を超えると部品が見つからないことを意味 します。

ある階層のピラミッドレベルでモデルが画像の境界線に触れた場合、 モデルが元の画像内に完全に含まれていてもモデルが見つからないことがあります。 経験則としては、画像境界までの距離が\(2^{NumLevels-1}\)未満になると モデルが見つからなくなるかもしれません。 この動作は、set_system('border_shape_models','true') によって変更で き、MinScoreCompminScoreCompmin_score_comp より大きいスコアである場合、検索される画 像領域の外にはみ出したコンポーネントとなります。ここでは、画像の外に ある点は隠れているとみなされます、つまりスコアが低くなります。 このモードでは、検索の実行時間が増加するということに注意してください。

レアケースとして、人工画像を使用した場合の話になりますが、 ある階層のピラミッドレベルモデルが限定されたドメインの境界に 接しているときにモデルが見つからないことがあります。 その場合、例えばdilation_circleDilationCircleを使用し、 限定されたドメインを\(2^{NumLevels-1}\)拡大すると 改善することがあります。

ピラミッドレベルを通してマッチング結果を解析するとき、ピラミッドの各レベルで NumMatchesnumMatchesnum_matchesを基に有望でないマッチング候補は対象外となります。 そのため、最も詳細粒度のピラミッドレベルでスコアが高く検出されるはずのマッチングが それ以前でのマッチングにより対象外となることが起こりえます。 従って、例えば、 NumMatchesnumMatchesnum_matches を 11 にセットして マッチングを行った結果は、NumMatchesnumMatchesnum_matches を 00 または 11 よりも大きく設定して 得られた最大スコアのマッチング結果とは異なることがあります。

推奨事項🔗

類似したスコアが予測される複数のオブジェクトの内、最もスコアが高い 結果ただ一つのみを得たい場合、NumMatchesnumMatchesnum_matchesの値を上げて 得られた結果のうちで、最もスコアが高い結果を選択することをお勧めします。

意味のあるスコアの値を取得し、誤ったマッチングを避けるために、いつも 最小二乗法を適用したサブピクセル精度での抽出と変形許容量(max_deformation) の設定を組み合わせることをお勧めします。 サブピクセルの抽出または最大オブジェクト変形、 あるいはその両方が各部品に個別に指定される場合、 ComponentModelIDcomponentModelIDcomponent_model_id の各部品のサブピクセルの抽出に対して、正 確に1つの値を SubPixelCompsubPixelCompsub_pixel_comp で渡す必要があります。サブピ クセルの抽出に対するそれぞれの値を渡した後に、対応するモードにおけ る最大オブジェクト変形を記述する2番目の値をオプションで渡すこと ができます。部品の最大オブジェクト変形に対する値が渡されない場合、 部品は変形を考慮しないで検索されます。より詳細な説明は、 find_shape_modelsFindShapeModels を参照してください。

実行情報🔗

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

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

  • 並列演算処理には未対応

パラメーター🔗

Imageimageimage (input_object) (multichannel-)image → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

部品モデルが探索される入力画像

ComponentModelIDcomponentModelIDcomponent_model_id (input_control) component_model → (handle)HTuple (HHandle)HComponentModel, HTuple (IntPtr)HHandleHtuple (handle)

部品モデルのハンドル

RootComponentrootComponentroot_component (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

ルートの部品のインデックス

推奨値: 0, 1, 2, 3, 4, 5, 6, 7, 80, 1, 2, 3, 4, 5, 6, 7, 8

AngleStartRootangleStartRootangle_start_root (input_control) angle.rad(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

ルートの部品の開始角度

初期値: -0.39-0.39
推奨値: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0-3.14, -1.57, -0.79, -0.39, -0.20, 0.0

AngleExtentRootangleExtentRootangle_extent_root (input_control) angle.rad(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

ルートの部品の回転範囲

初期値: 0.790.79
推奨値: 6.28, 3.14, 1.57, 0.79, 0.39, 0.06.28, 3.14, 1.57, 0.79, 0.39, 0.0
制限: AngleExtentRoot >= 0

MinScoreminScoremin_score (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

探索される部品モデルの最小スコア

初期値: 0.50.5
推奨値: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
最小増分: 0.01
推奨増分: 0.05
制限: 0 <= MinScore && MinScore <= 1

NumMatchesnumMatchesnum_matches (input_control) integer → (integer)HTuple (Hlong)HTuple (int / long)intHtuple (Hlong)

探索される部品モデル全体の数(0に設定すると全てを探索します)

初期値: 11
推奨値: 0, 1, 2, 3, 4, 5, 10, 200, 1, 2, 3, 4, 5, 10, 20

MaxOverlapmaxOverlapmax_overlap (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

探索される部品モデル全体の重なりの最大値

初期値: 0.50.5
推奨値: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
最小増分: 0.01
推奨増分: 0.05
制限: 0 <= MaxOverlap && MaxOverlap <= 1

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

ルートの部品が見つからなかった場合のオペレーターの 動作

初期値: 'stop_search'"stop_search"
値のリスト: 'select_new_root', 'stop_search'"select_new_root", "stop_search"

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

ルート以外の部品が見つからなかった場合のオペ レーターの動作

初期値: 'prune_branch'"prune_branch"
値のリスト: 'prune_branch', 'search_from_best', 'search_from_upper'"prune_branch", "search_from_best", "search_from_upper"

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

見つからなかった部品の姿勢の推定

初期値: 'none'"none"
値のリスト: 'from_all', 'from_neighbors', 'none'"from_all", "from_neighbors", "none"

MinScoreCompminScoreCompmin_score_comp (input_control) real(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

検出部品の最小スコア

初期値: 0.50.5
推奨値: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
最小増分: 0.01
推奨増分: 0.05
制限: 0 <= MinScoreComp && MinScoreComp <= 1

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

'none'"none"でない場合の部品の姿勢のサブピクセル 精度の指定

初期値: 'least_squares'"least_squares"
推奨値: 'none', 'interpolation', 'least_squares', 'least_squares_high', 'least_squares_very_high', 'max_deformation 1', 'max_deformation 2', 'max_deformation 3', 'max_deformation 4', 'max_deformation 5', 'max_deformation 6'"none", "interpolation", "least_squares", "least_squares_high", "least_squares_very_high", "max_deformation 1", "max_deformation 2", "max_deformation 3", "max_deformation 4", "max_deformation 5", "max_deformation 6"

NumLevelsCompnumLevelsCompnum_levels_comp (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

マッチングの際に部品に使用されるピラミッドレベル 数(および \(|\textrm{NumLevelsComp}| = 2n\) の 場合:使用される最小ピラミッドレベル数)

初期値: 00
値のリスト: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 100, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

GreedinessCompgreedinessCompgreediness_comp (input_control) real(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

部品探索のための “Greediness”(0: 安全だが遅い、1: 早いがミスが起き得る)

初期値: 0.90.9
推奨値: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
最小増分: 0.01
推奨増分: 0.05
制限: 0 <= GreedinessComp && GreedinessComp <= 1

ModelStartmodelStartmodel_start (output_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

見つかった部品モデルのインスタンスの開始インデック ス

ModelEndmodelEndmodel_end (output_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

見つかった部品モデルのインスタンスの終了インデック ス

Scorescorescore (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

見つかった部品モデルの全体のスコア

RowComprowComprow_comp (output_control) point.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

見つかった部品の行座標

ColumnCompcolumnCompcolumn_comp (output_control) point.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

見つかった部品の列座標

AngleCompangleCompangle_comp (output_control) angle.rad(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

見つかった部品の回転角度

ScoreCompscoreCompscore_comp (output_control) real(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

見つかった部品のスコア

ModelCompmodelCompmodel_comp (output_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)Sequence[int]Htuple (Hlong)

見つかった部品のインデックス

結果🔗

パラメーター値が正しいならば、オペレーター find_component_modelFindComponentModel は値 2 (H_MSG_TRUE) を返します。入力が空である (入力画像が利用できない)場合、 set_system('no_object_result',<Result>) を通じて設定されま す。必要に応じて、例外が発生します。

モジュール🔗

Matching