get_training_componentsT_get_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_components (Operator)
get_training_componentsT_get_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_components
— Return the initial or model components in a certain image.
Warning
get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_components
is obsolete and is only provided for
reasons of backward compatibility.
The operator will be removed with HALCON 26.11.
Signature
void GetTrainingComponents(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)
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)
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)
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]
Description
get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_components
returns all initial components (if
ComponentsComponentsComponentscomponentscomponents
= 'initial_components'"initial_components""initial_components""initial_components""initial_components") or all model
components (if ComponentsComponentsComponentscomponentscomponents
= 'model_components'"model_components""model_components""model_components""model_components")
in TrainingComponentsTrainingComponentsTrainingComponentstrainingComponentstraining_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_componentstrain_model_componentsTrainModelComponentsTrainModelComponentstrain_model_components
) are returned.
The pose of the returned components corresponds to their pose in the
model image (if ImageImageImageimageimage
= 'model_image'"model_image""model_image""model_image""model_image" or
ImageImageImageimageimage
= 0) or in a training image (if
ImageImageImageimageimage
>= 1). In order to obtain the
components in the pose at which they were found in the ith
training image, ImageImageImageimageimage
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 MarkOrientationMarkOrientationMarkOrientationmarkOrientationmark_orientation
to 'true'"true""true""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 RowRowRowrowrow
, ColumnColumnColumncolumncolumn
,
AngleAngleAngleangleangle
, and ScoreScoreScorescorescore
(see
find_shape_modelfind_shape_modelFindShapeModelFindShapeModelfind_shape_model
). If ComponentsComponentsComponentscomponentscomponents
was set to
'initial_components'"initial_components""initial_components""initial_components""initial_components" or 'model_components'"model_components""model_components""model_components""model_components", the
tuples TrainingComponentsTrainingComponentsTrainingComponentstrainingComponentstraining_components
, RowRowRowrowrow
, ColumnColumnColumncolumncolumn
,
AngleAngleAngleangleangle
, and ScoreScoreScorescorescore
always contain the same number of
elements as initial components or model components contained in
ComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingIDcomponent_training_id
, respectively. If one component was not
found in the image, an empty region is returned in the corresponding
element of TrainingComponentsTrainingComponentsTrainingComponentstrainingComponentstraining_components
and the elements of the four
output control parameters are set to the value 0. In
contrast, if the index of an initial component is passed in
ComponentsComponentsComponentscomponentscomponents
, these tuples contain as many elements as
matches of the corresponding initial component were found in the
image.
The operator get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_components
is particularly useful
in order to visualize the result of the training
ComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingIDcomponent_training_id
, which was performed with
train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentstrain_model_components
. With this, it is possible to
evaluate the suitability of the training images or to inspect the
influence of the parameters of
train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentstrain_model_components
. Sometimes it might be reasonable to
restart the training with train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentstrain_model_components
using
a different set of training images or after adjusting the
parameters.
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
TrainingComponentsTrainingComponentsTrainingComponentstrainingComponentstraining_components
(output_object) region(-array) →
objectHRegionHObjectHObjectHobject *
Contour regions of the initial components or of
the model components.
ComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingIDcomponent_training_id
(input_control) component_training →
HComponentTraining, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Handle of the training result.
ComponentsComponentsComponentscomponentscomponents
(input_control) string →
HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Type of returned components or index of an initial
component.
Default:
'model_components'
"model_components"
"model_components"
"model_components"
"model_components"
Suggested values:
'model_components'"model_components""model_components""model_components""model_components", 'initial_components'"initial_components""initial_components""initial_components""initial_components", 0, 1, 2, 3, 4, 5
ImageImageImageimageimage
(input_control) string →
HTupleUnion[str, int]HTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)
Image for which the components are to be returned.
Default:
'model_image'
"model_image"
"model_image"
"model_image"
"model_image"
Suggested values:
'model_image'"model_image""model_image""model_image""model_image", 0, 1, 2, 3, 4, 5, 6, 7, 8
MarkOrientationMarkOrientationMarkOrientationmarkOrientationmark_orientation
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Mark the orientation of the components.
Default:
'false'
"false"
"false"
"false"
"false"
List of values:
'false'"false""false""false""false", 'true'"true""true""true""true"
RowRowRowrowrow
(output_control) point.y(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Row coordinate of the found instances of all
initial components or model components.
ColumnColumnColumncolumncolumn
(output_control) point.x(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Column coordinate of the found instances of all
initial components or model components.
AngleAngleAngleangleangle
(output_control) angle.rad(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Rotation angle of the found instances of all
components.
ScoreScoreScorescorescore
(output_control) real(-array) →
HTupleSequence[float]HTupleHtuple (real) (double) (double) (double)
Score of the found instances of all components.
Result
If the handle of the training result is valid, the operator
get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsget_training_components
returns the value 2 (
H_MSG_TRUE)
.
If necessary, an exception is raised.
Module
Matching