Name
create_trained_component_modelT_create_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModel — Prepare a component model for matching based on trained components.
create_trained_component_model( : : ComponentTrainingID, AngleStart, AngleExtent, MinContrastComp, MinScoreComp, NumLevelsComp, AngleStepComp, OptimizationComp, MetricComp, PregenerationComp : ComponentModelID, RootRanking)
Herror T_create_trained_component_model(const Htuple ComponentTrainingID, const Htuple AngleStart, const Htuple AngleExtent, const Htuple MinContrastComp, const Htuple MinScoreComp, const Htuple NumLevelsComp, const Htuple AngleStepComp, const Htuple OptimizationComp, const Htuple MetricComp, const Htuple PregenerationComp, Htuple* ComponentModelID, Htuple* RootRanking)
void CreateTrainedComponentModel(const HTuple& ComponentTrainingID, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HTuple& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp, HTuple* ComponentModelID, HTuple* RootRanking)
HComponentModel HComponentTraining::CreateTrainedComponentModel(double AngleStart, double AngleExtent, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp, HTuple* RootRanking) const
HComponentModel HComponentTraining::CreateTrainedComponentModel(double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp, Hlong* RootRanking) const
HComponentModel HComponentTraining::CreateTrainedComponentModel(double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp, Hlong* RootRanking) const
void HComponentModel::HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp, HTuple* RootRanking)
void HComponentModel::HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp, Hlong* RootRanking)
void HComponentModel::HComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp, Hlong* RootRanking)
HTuple HComponentModel::CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, const HTuple& MinContrastComp, const HTuple& MinScoreComp, const HTuple& NumLevelsComp, const HTuple& AngleStepComp, const HString& OptimizationComp, const HTuple& MetricComp, const HTuple& PregenerationComp)
Hlong HComponentModel::CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const HString& OptimizationComp, const HString& MetricComp, const HString& PregenerationComp)
Hlong HComponentModel::CreateTrainedComponentModel(const HComponentTraining& ComponentTrainingID, double AngleStart, double AngleExtent, Hlong MinContrastComp, double MinScoreComp, Hlong NumLevelsComp, double AngleStepComp, const char* OptimizationComp, const char* MetricComp, const char* PregenerationComp)
static void HOperatorSet.CreateTrainedComponentModel(HTuple componentTrainingID, HTuple angleStart, HTuple angleExtent, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, HTuple optimizationComp, HTuple metricComp, HTuple pregenerationComp, out HTuple componentModelID, out HTuple rootRanking)
HComponentModel HComponentTraining.CreateTrainedComponentModel(double angleStart, double angleExtent, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp, out HTuple rootRanking)
HComponentModel HComponentTraining.CreateTrainedComponentModel(double angleStart, double angleExtent, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp, out int rootRanking)
public HComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp, out HTuple rootRanking)
public HComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp, out int rootRanking)
HTuple HComponentModel.CreateTrainedComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, HTuple minContrastComp, HTuple minScoreComp, HTuple numLevelsComp, HTuple angleStepComp, string optimizationComp, HTuple metricComp, HTuple pregenerationComp)
int HComponentModel.CreateTrainedComponentModel(HComponentTraining componentTrainingID, double angleStart, double angleExtent, int minContrastComp, double minScoreComp, int numLevelsComp, double angleStepComp, string optimizationComp, string metricComp, string pregenerationComp)
create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModel prepares the training result,
which is passed in ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID, as a component
model for matching. The output parameter ComponentModelIDComponentModelIDComponentModelIDComponentModelIDcomponentModelID
is a handle for this model, which is used in subsequent calls to
find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel. In contrast to
create_component_modelcreate_component_modelCreateComponentModelCreateComponentModelCreateComponentModel, the model components must have been
previously trained using train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents before
calling create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModel.
The parameters AngleStartAngleStartAngleStartAngleStartangleStart and AngleExtentAngleExtentAngleExtentAngleExtentangleExtent
determine the range of possible rotations of the component model in
an image.
Internally, a separate shape model is built for each model component
(see create_shape_modelcreate_shape_modelCreateShapeModelCreateShapeModelCreateShapeModel). Therefore, the parameters
MinContrastCompMinContrastCompMinContrastCompMinContrastCompminContrastComp, MinScoreCompMinScoreCompMinScoreCompMinScoreCompminScoreComp,
NumLevelsCompNumLevelsCompNumLevelsCompNumLevelsCompnumLevelsComp, AngleStepCompAngleStepCompAngleStepCompAngleStepCompangleStepComp,
OptimizationCompOptimizationCompOptimizationCompOptimizationCompoptimizationComp, MetricCompMetricCompMetricCompMetricCompmetricComp, and
PregenerationCompPregenerationCompPregenerationCompPregenerationComppregenerationComp correspond to the parameters of
create_shape_modelcreate_shape_modelCreateShapeModelCreateShapeModelCreateShapeModel, with the following differences: First,
the parameter OptimizationOptimizationOptimizationOptimizationoptimization of create_shape_modelcreate_shape_modelCreateShapeModelCreateShapeModelCreateShapeModel
provides the possibility to reduce the number of model points as
well as the possibility to completely pregenerate the shape
model. In contrast, the operator
create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModel uses a separate parameter
PregenerationCompPregenerationCompPregenerationCompPregenerationComppregenerationComp in order to decide whether the shape
models should be completely pregenerated or not. A second difference
concerning the parameter MinScoreCompMinScoreCompMinScoreCompMinScoreCompminScoreComp should be noted. When
using the shape-based matching, this parameter needs not be passed
when preparing the shape model using create_shape_modelcreate_shape_modelCreateShapeModelCreateShapeModelCreateShapeModel but
only during the search using find_shape_modelfind_shape_modelFindShapeModelFindShapeModelFindShapeModel. In contrast,
when preparing the component model it is favorable to analyze
rotational symmetries of the model components and similarities
between the model components. However, this analysis only leads to
meaningful results if the value for MinScoreCompMinScoreCompMinScoreCompMinScoreCompminScoreComp that is
used during the search (see find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel) is already
approximately known. After the search with
find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel the pose parameters of the components
in a search image are returned. Note that the pose parameters refer
to the reference points of the components. The reference point of a
component is the center of gravity of its associated region that is
returned in ModelComponentsModelComponentsModelComponentsModelComponentsmodelComponents of
train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents.
The parameters MinContrastCompMinContrastCompMinContrastCompMinContrastCompminContrastComp, NumLevelsCompNumLevelsCompNumLevelsCompNumLevelsCompnumLevelsComp,
AngleStepCompAngleStepCompAngleStepCompAngleStepCompangleStepComp, and OptimizationCompOptimizationCompOptimizationCompOptimizationCompoptimizationComp can be
automatically determined by passing 'auto'"auto""auto""auto""auto" for the
respective parameters.
All component-specific input parameters (parameter names terminate
with the suffix Comp) must either contain one element, in
which case the parameter is used for all model components, or must
contain the same number of elements as the number of model
components contained in ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID, in which case
each parameter element refers to the corresponding component in
ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID.
In addition to the individual shape models, the component model also
contains information about the way the single model components must
be searched relative to each other using
find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel in order to minimize the computation
time of the search. For this, the components are represented in a
tree structure. First, the component that stands at the root of
this search tree (root component) is searched. Then, the remaining
components are searched relative to the pose of their predecessor in
the search tree.
The root component can be passed as an input parameter of
find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel during the search. To what extent a model
component is suited to act as root component depends on several factors. In
principle, a model component that can be found in the image with a high
probability should be chosen. Therefore, a component that is sometimes
occluded to a high degree or that is missing in some cases is not well suited
to act as root component. Additionally, the computation time that is
associated with the root component during the search can serve as a
criterion. A ranking of the model components that is based on the latter
criterion is returned in RootRankingRootRankingRootRankingRootRankingrootRanking. In this parameter the indices
of the model components are sorted in descending order according to their
associated computation time, i.e., RootRankingRootRankingRootRankingRootRankingrootRanking[0] contains the index
of the model component that, chosen as root component, allows the fastest
search. Note that the ranking returned in RootRankingRootRankingRootRankingRootRankingrootRanking represents
only a coarse estimation. Furthermore, the calculation of the root ranking
assumes that the image size as well as the value of the system parameter
'border_shape_models'"border_shape_models""border_shape_models""border_shape_models""border_shape_models" are identical when calling
create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModel and find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel.
- Multithreading type: reentrant (runs in parallel with non-exclusive operators).
- Multithreading scope: global (may be called from any thread).
- Processed without parallelization.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
Handle of the training result.
Smallest rotation of the component model.
Default value: -0.39
Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0
Extent of the rotation of the component model.
Default value: 0.79
Suggested values: 6.28, 3.14, 1.57, 0.79, 0.39
Restriction: AngleExtent >= 0
Minimum contrast of the components in the search
images.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto", 10, 20, 20, 40
Restriction: MinContrastComp >= 0
Minimum score of the instances of the components to
be found.
Default value: 0.5
Suggested values: 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
Minimum increment: 0.01
Recommended increment: 0.05
Restriction: 0 <= MinScoreComp && MinScoreComp <= 1
Maximum number of pyramid levels for the components.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
List of values: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'auto'"auto""auto""auto""auto"
Step length of the angles (resolution) for the
components.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
Suggested values: 'auto'"auto""auto""auto""auto", 0.0175, 0.0349, 0.0524, 0.0698, 0.0873
Restriction: AngleStepComp >= 0
Kind of optimization for the components.
Default value:
'auto'
"auto"
"auto"
"auto"
"auto"
List of values: 'auto'"auto""auto""auto""auto", 'none'"none""none""none""none", 'point_reduction_high'"point_reduction_high""point_reduction_high""point_reduction_high""point_reduction_high", 'point_reduction_low'"point_reduction_low""point_reduction_low""point_reduction_low""point_reduction_low", 'point_reduction_medium'"point_reduction_medium""point_reduction_medium""point_reduction_medium""point_reduction_medium"
Match metric used for the components.
Default value:
'use_polarity'
"use_polarity"
"use_polarity"
"use_polarity"
"use_polarity"
List of values: 'ignore_color_polarity'"ignore_color_polarity""ignore_color_polarity""ignore_color_polarity""ignore_color_polarity", 'ignore_global_polarity'"ignore_global_polarity""ignore_global_polarity""ignore_global_polarity""ignore_global_polarity", 'ignore_local_polarity'"ignore_local_polarity""ignore_local_polarity""ignore_local_polarity""ignore_local_polarity", 'use_polarity'"use_polarity""use_polarity""use_polarity""use_polarity"
Complete pregeneration of the shape models for the
components if equal to 'true'"true""true""true""true".
Default value:
'false'
"false"
"false"
"false"
"false"
List of values: 'false'"false""false""false""false", 'true'"true""true""true""true"
Handle of the component model.
Ranking of the model components expressing the
suitability to act as the root component.
* 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.65, \
0, 0, rad(60), 'speed', 'rigidity', 0.2, 0.4, \
ComponentTrainingID)
* Create the component model based on the training result.
create_trained_component_model (ComponentTrainingID, -rad(30), rad(60), 10, \
0.5, 'auto', 'auto', 'none', \
'use_polarity', 'false', ComponentModelID, \
RootRanking)
* Find the component model in a run-time image.
read_image (SearchImage, 'search_image.tif')
find_component_model (SearchImage, ComponentModelID, RootRanking, -rad(30), \
rad(60), 0.5, 0, 0.5, 'stop_search', 'prune_branch', \
'none', 0.55, 'least_squares', 0, 0.9, ModelStart, \
ModelEnd, Score, RowComp, ColumnComp, AngleComp, \
ScoreComp, ModelComp)
If the parameters are valid, the operator
create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModel returns the value 2 (H_MSG_TRUE). If
necessary an exception is raised.
train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents,
read_training_componentsread_training_componentsReadTrainingComponentsReadTrainingComponentsReadTrainingComponents
find_component_modelfind_component_modelFindComponentModelFindComponentModelFindComponentModel
create_component_modelcreate_component_modelCreateComponentModelCreateComponentModelCreateComponentModel
create_shape_modelcreate_shape_modelCreateShapeModelCreateShapeModelCreateShapeModel,
find_shape_modelfind_shape_modelFindShapeModelFindShapeModelFindShapeModel
Matching