Skip to content

get_component_relationsGetComponentRelationsGetComponentRelationsget_component_relationsT_get_component_relations🔗

説明🔗

get_component_relationsGetComponentRelationsGetComponentRelationsget_component_relationsT_get_component_relations — トレーニング結果を含むモデルの部品間の関係を返す。

警告🔗

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

書式🔗

get_component_relations( out region Relations, component_training ComponentTrainingID, integer ReferenceComponent, string Image, out rectangle2.center.y Row, out rectangle2.center.x Column, out rectangle2.angle.rad Phi, out rectangle2.hwidth Length1, out rectangle2.hheight Length2, out angle.rad AngleStart, out angle.rad AngleExtent )void GetComponentRelations( HObject* Relations, const HTuple& ComponentTrainingID, const HTuple& ReferenceComponent, const HTuple& Image, HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2, HTuple* AngleStart, HTuple* AngleExtent )static void HOperatorSet.GetComponentRelations( out HObject relations, HTuple componentTrainingID, HTuple referenceComponent, HTuple image, out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2, out HTuple angleStart, out HTuple angleExtent )def get_component_relations( component_training_id: HHandle, reference_component: int, image: Union[str, int] ) -> Tuple[HObject, Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def get_component_relations_s( component_training_id: HHandle, reference_component: int, image: Union[str, int] ) -> Tuple[HObject, float, float, float, float, float, float, float]Herror T_get_component_relations( Hobject* Relations, const Htuple ComponentTrainingID, const Htuple ReferenceComponent, const Htuple Image, Htuple* Row, Htuple* Column, Htuple* Phi, Htuple* Length1, Htuple* Length2, Htuple* AngleStart, Htuple* AngleExtent )

HRegion HComponentTraining::GetComponentRelations( Hlong ReferenceComponent, const HTuple& Image, HTuple* Row, HTuple* Column, HTuple* Phi, HTuple* Length1, HTuple* Length2, HTuple* AngleStart, HTuple* AngleExtent ) const

HRegion HComponentTraining::GetComponentRelations( Hlong ReferenceComponent, const HString& Image, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent ) const

HRegion HComponentTraining::GetComponentRelations( Hlong ReferenceComponent, const char* Image, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent ) const

HRegion HComponentTraining::GetComponentRelations( Hlong ReferenceComponent, const wchar_t* Image, double* Row, double* Column, double* Phi, double* Length1, double* Length2, double* AngleStart, double* AngleExtent ) const (Windows only)

HRegion HComponentTraining.GetComponentRelations( int referenceComponent, HTuple image, out HTuple row, out HTuple column, out HTuple phi, out HTuple length1, out HTuple length2, out HTuple angleStart, out HTuple angleExtent )

HRegion HComponentTraining.GetComponentRelations( int referenceComponent, string image, out double row, out double column, out double phi, out double length1, out double length2, out double angleStart, out double angleExtent )

説明🔗

get_component_relationsGetComponentRelations は、 train_model_componentsTrainModelComponents でモデルのトレーニングをした後の、 モデルの部品間の関係を返します。 パラメーター ReferenceComponentreferenceComponentreference_component で、参照する部品を選択す ることができます。get_component_relationsGetComponentRelations は、モデル画像 ( Imageimageimage \(=\) 'model_image'"model_image" または Imageimageimage \(=\) 00 の場合) またはトレーニング画像 (Imageimageimage >= 11 の場合) 内で、参照部品とその他すべての部品間と の関係を返します。i 番目のトレーニング画像の関係を得るため に、画像 Imageimageimage を i に設定する必要があります。 train_model_componentsTrainModelComponents で返されたトレーニング結果は、 ComponentTrainingIDcomponentTrainingIDcomponent_training_id に渡す必要があります。 ReferenceComponentreferenceComponentreference_component は、参照部品のインデックスが記述され、 もし n をモデルの部品数とするならば、0 から n-1 ま での範囲内になります(train_model_componentsTrainModelComponents を参照してく ださい)。

関係は、Relationsrelationsrelations にRegionの形式で返され、同様に Rowrowrow、~ Columncolumncolumn、~ Phiphiphi、~ Length1length1length_1、~ Length2length2length_2、~ AngleStartangleStartangle_start、および AngleExtentangleExtentangle_extent に数値として返されます。

領域オブジェクトはRelationsrelationsrelations は、以下のように構成さ れています。各部品は分割された領域として返されます。したがって、 Relationsrelationsrelations は n 個の領域を含みます。nは、対応する 部品群のインデックスによって決定される tuple 内の領域の数です。画 像内のすべてのコンポーネント位置は、半径3ピクセルの円で表現され ます。参照部品 ReferenceComponentreferenceComponentreference_component から他の各部品に対し、 参照部品との位置関係、方向関係が付加的に表現されます。位置関係は、 矩形によって表現され、方向関係は、半径30ピクセルの扇形によって表 現されます。円の中心がコンポーネントの平均相対位置に設置されます。 矩形は、扇形が記述している方向の関係の変位の中で、参照部品の姿勢に 関連する、それぞれの部品の参照点の動きを記述しています( train_model_componentsTrainModelComponents を参照)。0の相対配向 はモデル画像での両方のコンポーネントの相対配向に対応します。もし両 方の部品がすべての画像中で同じ方向関係で現れた場合、その結果、扇形 は直線として生成されます。

領域オブジェクト Relationsrelationsrelations に加え、関係は Rowrowrow、Columncolumncolumn、Phiphiphi、Length1length1length_1、 Length2length2length_2、AngleStartangleStartangle_start、および AngleExtentangleExtentangle_extent に数値としても返されます。これらのパラメー ターは、すべての部品の関係を含む、長さ n の tuple です。 n は前述のとおりです。位置関係は、対応する矩形のパラメー ター Rowrowrow、Columncolumncolumn、Phiphiphi、Length1length1length_1 、および Length2length2length_2 によって記述されます( gen_rectangle2GenRectangle2 を参照してください)。方向関係は、開始角度 AngleStartangleStartangle_start と角度範囲 AngleExtentangleExtentangle_extent で指定されま す。参照部品においてのみ、画像内の値は、Rowrowrow と Columncolumncolumn に返されます。他の部品での値は 00 に設定さ れます。

もし参照部品が現在の画像で見つからない場合、空の領域の配列が返さ れ、対応するパラメーターの値はすべて 00 に設定されます。

オペレーター get_component_relationsGetComponentRelations は train_model_componentsTrainModelComponents によって実行されたトレーニングの結 果を視覚的に表現するためには非常に有用です。これを用いて、トレーニ ング画像における変位を評価することが可能になります。時として、ト レーニング画像の異なる設定を用いている際に、 train_model_componentsTrainModelComponents でのトレーニングをやり直すほうが適 していることもあります。

実行情報🔗

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

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

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

パラメーター🔗

Relationsrelationsrelations (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

関係の領域表現

ComponentTrainingIDcomponentTrainingIDcomponent_training_id (input_control) component_training → (handle)HTuple (HHandle)HComponentTraining, HTuple (IntPtr)HHandleHtuple (handle)

トレーニング結果のハンドル

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

参照部品のインデックス

制限: ReferenceComponent >= 0

Imageimageimage (input_control) string → (string / integer)HTuple (HString / Hlong)HTuple (string / int / long)Union[str, int]Htuple (char* / Hlong)

部品の関係を求めるための画像

初期値: 'model_image'"model_image"
推奨値: 'model_image', 0, 1, 2, 3, 4, 5, 6, 7, 8"model_image", 0, 1, 2, 3, 4, 5, 6, 7, 8

Rowrowrow (output_control) rectangle2.center.y(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

関係を表現する矩形の中心行座標

Columncolumncolumn (output_control) rectangle2.center.x(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

関係を表現する矩形の中心列座標

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

関係を表現する矩形の方向(ラジアン)

制限: -pi / 2 < Phi && Phi <= pi / 2

Length1length1length_1 (output_control) rectangle2.hwidth(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

関係を表現する矩形の最初の半径(半分の長さ)

制限: Length1 >= 0.0

Length2length2length_2 (output_control) rectangle2.hheight(-array) → (real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

関係を表現する矩形の 2 番目の半径(半分の幅)

制限: Length2 >= 0.0 && Length2 <= Length1

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

最小相対方向角度

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

AngleStart からの角度の幅

結果🔗

トレーニング結果のハンドルが有効であれば、オペレーター get_component_relationsGetComponentRelations は、値 2 (H_MSG_TRUE) を返します。必要に応じ て、例外処理が発生します。

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

組み合わせ

関連項目

gen_rectangle2GenRectangle2

モジュール🔗

Matching