ClassesClasses | | Operators

get_training_componentsT_get_training_componentsGetTrainingComponentsGetTrainingComponents (Operator)

Name

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

Signature

get_training_components( : TrainingComponents : ComponentTrainingID, Components, Image, MarkOrientation : Row, Column, Angle, Score)

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)

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

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)

Description

get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsGetTrainingComponents 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 TrainingComponentsTrainingComponentsTrainingComponentsTrainingComponentstrainingComponents 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_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents) 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 MarkOrientationMarkOrientationMarkOrientationMarkOrientationmarkOrientation 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_modelFindShapeModelFindShapeModelFindShapeModel). 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 TrainingComponentsTrainingComponentsTrainingComponentsTrainingComponentstrainingComponents, RowRowRowRowrow, ColumnColumnColumnColumncolumn, AngleAngleAngleAngleangle, and ScoreScoreScoreScorescore always contain the same number of elements as initial components or model components contained in ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID, respectively. If one component was not found in the image, an empty region is returned in the corresponding element of TrainingComponentsTrainingComponentsTrainingComponentsTrainingComponentstrainingComponents 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_componentsGetTrainingComponentsGetTrainingComponentsGetTrainingComponents is particularly useful in order to visualize the result of the training ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID, which was performed with train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents. 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_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents. Sometimes it might be reasonable to restart the training with train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents using a different set of training images or after adjusting the parameters.

Execution Information

Parameters

TrainingComponentsTrainingComponentsTrainingComponentsTrainingComponentstrainingComponents (output_object)  region(-array) objectHRegionHRegionHobject *

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

ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID (input_control)  component_training HComponentTraining, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the training result.

ComponentsComponentsComponentsComponentscomponents (input_control)  string HTupleHTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Type of returned components or index of an initial component.

Default value: '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 HTupleHTupleHtuple (string / integer) (string / int / long) (HString / Hlong) (char* / Hlong)

Image for which the components are to be returned.

Default value: '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

MarkOrientationMarkOrientationMarkOrientationMarkOrientationmarkOrientation (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Mark the orientation of the components.

Default value: 'false' "false" "false" "false" "false"

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

RowRowRowRowrow (output_control)  point.y(-array) HTupleHTupleHtuple (real) (double) (double) (double)

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

ColumnColumnColumnColumncolumn (output_control)  point.x(-array) HTupleHTupleHtuple (real) (double) (double) (double)

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

AngleAngleAngleAngleangle (output_control)  angle.rad(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Rotation angle of the found instances of all components.

ScoreScoreScoreScorescore (output_control)  real(-array) HTupleHTupleHtuple (real) (double) (double) (double)

Score of the found instances of all components.

Example (HDevelop)

* Get the model image.
read_image (ModelImage, 'model_image.tif')
* Define the regions for the initial components.
gen_rectangle2 (InitialComponentRegions, 212, 233, 0.62, 167, 29)
gen_rectangle2 (Rectangle2, 298, 363, 1.17, 162, 34)
gen_rectangle2 (Rectangle3, 63, 444, -0.26, 50, 27)
gen_rectangle2 (Rectangle4, 120, 473, 0, 33, 20)
concat_obj (InitialComponentRegions, Rectangle2, InitialComponentRegions)
concat_obj (InitialComponentRegions, Rectangle3, InitialComponentRegions)
concat_obj (InitialComponentRegions, Rectangle4, InitialComponentRegions)
* Get the training images.
gen_empty_obj (TrainingImages)
for i := 1 to 4 by 1
    read_image (TrainingImage, 'training_image-'+i+'.tif')
    concat_obj (TrainingImages, TrainingImage, TrainingImages)
endfor
* Extract the model components and train the relations.
train_model_components (ModelImage, InitialComponentRegions, \
                        TrainingImages, ModelComponents, 22, 60, 30, 0.6, \
                        0, 0, rad(60), 'speed', 'rigidity', 0.2, 0.4, \
                        ComponentTrainingID)
* Visualize the result of the training.
count_obj (InitialComponentRegions, NumInitComp)
count_obj (TrainingImages, NumTrainings)
for i := 1 to NumTrainings by 1
    select_obj (TrainingImages, TrainingImage, i)
    for j := 0 to NumInitComp-1 by 1
        * Visualize the ambiguous poses of each initial component.
        get_training_components (TrainingComponents, ComponentTrainingID, \
                                 j, i, 'false', Row, Column, Angle, Score)
    endfor
    * Visualize the final poses of the initial components.
    get_training_components (TrainingComponents, ComponentTrainingID, \
                             'initial_components', i, 'false', \
                             Row, Column, Angle, Score)
    * Visualize the final poses of the model components.
    get_training_components (TrainingComponents, ComponentTrainingID, \
                             'model_components', i, 'false', \
                             Row, Column, Angle, Score)
endfor

Result

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

Possible Predecessors

train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents

Possible Successors

train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents

See also

find_shape_modelfind_shape_modelFindShapeModelFindShapeModelFindShapeModel

Module

Matching


ClassesClasses | | Operators