Skip to content

get_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_componentsT_get_training_components🔗

Short description🔗

get_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_componentsT_get_training_components — Return the initial or model components in a certain image.

Warning🔗

get_training_componentsGetTrainingComponents is obsolete and is only provided for reasons of backward compatibility. The operator will be removed with HALCON 26.11.

Signature🔗

get_training_components( out region TrainingComponents, component_training ComponentTrainingID, string Components, string Image, string MarkOrientation, out point.y Row, out point.x Column, out angle.rad Angle, out real Score )void GetTrainingComponents( HObject* TrainingComponents, const HTuple& ComponentTrainingID, const HTuple& Components, const HTuple& Image, const HTuple& MarkOrientation, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score )static void HOperatorSet.GetTrainingComponents( out HObject trainingComponents, HTuple componentTrainingID, HTuple components, HTuple image, HTuple markOrientation, out HTuple row, out HTuple column, out HTuple angle, out HTuple score )def get_training_components( component_training_id: HHandle, components: Union[str, int], image: Union[str, int], mark_orientation: str ) -> Tuple[HObject, Sequence[float], Sequence[float], Sequence[float], Sequence[float]]

def get_training_components_s( component_training_id: HHandle, components: Union[str, int], image: Union[str, int], mark_orientation: str ) -> Tuple[HObject, float, float, float, float]Herror T_get_training_components( Hobject* TrainingComponents, const Htuple ComponentTrainingID, const Htuple Components, const Htuple Image, const Htuple MarkOrientation, Htuple* Row, Htuple* Column, Htuple* Angle, Htuple* Score )

HRegion HComponentTraining::GetTrainingComponents( const HTuple& Components, const HTuple& Image, const HString& MarkOrientation, HTuple* Row, HTuple* Column, HTuple* Angle, HTuple* Score ) const

HRegion HComponentTraining::GetTrainingComponents( const HString& Components, const HString& Image, const HString& MarkOrientation, double* Row, double* Column, double* Angle, double* Score ) const

HRegion HComponentTraining::GetTrainingComponents( const char* Components, const char* Image, const char* MarkOrientation, double* Row, double* Column, double* Angle, double* Score ) const

HRegion HComponentTraining::GetTrainingComponents( const wchar_t* Components, const wchar_t* Image, const wchar_t* MarkOrientation, double* Row, double* Column, double* Angle, double* Score ) const (Windows only)

HRegion HComponentTraining.GetTrainingComponents( HTuple components, HTuple image, string markOrientation, out HTuple row, out HTuple column, out HTuple angle, out HTuple score )

HRegion HComponentTraining.GetTrainingComponents( string components, string image, string markOrientation, out double row, out double column, out double angle, out double score )

Description🔗

get_training_componentsGetTrainingComponents returns all initial components (if Componentscomponentscomponents \(=\) 'initial_components'"initial_components") or all model components (if Componentscomponentscomponents \(=\) 'model_components'"model_components") in TrainingComponentstrainingComponentstraining_components in form of contour regions as well as in numerical form. Alternatively, by directly passing the index of an initial component, all found poses of that initial component (i.e., the poses before solving the ambiguities in train_model_componentsTrainModelComponents) are returned.

The pose of the returned components corresponds to their pose in the model image (if Imageimageimage \(=\) 'model_image'"model_image" or Imageimageimage \(=\) 00) or in a training image (if Imageimageimage >= 11). In order to obtain the components in the pose at which they were found in the ith training image, Imageimageimage must be set to i. Furthermore, when dealing with rotationally symmetric components, one may wish to mark the current orientation of the found component. This can be achieved by setting MarkOrientationmarkOrientationmark_orientation to 'true'"true". In this case, the contour region of each component is complemented by an arrow at its reference point pointing in the reference direction. The reference direction of a component is based on the orientation of the component in the model image and is represented by an arrow that starts at the reference point and points to the right in the horizontal direction.

In addition to the contour regions, the pose and the score of all found components is returned in Rowrowrow, Columncolumncolumn, Angleangleangle, and Scorescorescore (see find_shape_modelFindShapeModel). If Componentscomponentscomponents was set to 'initial_components'"initial_components" or 'model_components'"model_components", the tuples TrainingComponentstrainingComponentstraining_components, Rowrowrow, Columncolumncolumn, Angleangleangle, and Scorescorescore always contain the same number of elements as initial components or model components contained in ComponentTrainingIDcomponentTrainingIDcomponent_training_id, respectively. If one component was not found in the image, an empty region is returned in the corresponding element of TrainingComponentstrainingComponentstraining_components and the elements of the four output control parameters are set to the value 00. In contrast, if the index of an initial component is passed in Componentscomponentscomponents, these tuples contain as many elements as matches of the corresponding initial component were found in the image.

The operator get_training_componentsGetTrainingComponents is particularly useful in order to visualize the result of the training ComponentTrainingIDcomponentTrainingIDcomponent_training_id, which was performed with train_model_componentsTrainModelComponents. With this, it is possible to evaluate the suitability of the training images or to inspect the influence of the parameters of train_model_componentsTrainModelComponents. Sometimes it might be reasonable to restart the training with train_model_componentsTrainModelComponents using a different set of training images or after adjusting the parameters.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

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

Contour regions of the initial components or of the model components.

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

Handle of the training result.

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

Type of returned components or index of an initial component.

Default: 'model_components'"model_components"
Suggested values: 'model_components', 'initial_components', 0, 1, 2, 3, 4, 5"model_components", "initial_components", 0, 1, 2, 3, 4, 5

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

Image for which the components are to be returned.

Default: 'model_image'"model_image"
Suggested values: 'model_image', 0, 1, 2, 3, 4, 5, 6, 7, 8"model_image", 0, 1, 2, 3, 4, 5, 6, 7, 8

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

Mark the orientation of the components.

Default: 'false'"false"
List of values: 'false', 'true'"false", "true"

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

Row coordinate of the found instances of all initial components or model components.

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

Column coordinate of the found instances of all initial components or model components.

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

Rotation angle of the found instances of all components.

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

Score of the found instances of all components.

Result🔗

If the handle of the training result is valid, the operator get_training_componentsGetTrainingComponents returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Module🔗

Matching