ClassesClasses | | Operators

cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponents (Operator)

Name

cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponents — Adopt new parameters that are used to create the model components into the training result.

Signature

cluster_model_components(TrainingImages : ModelComponents : ComponentTrainingID, AmbiguityCriterion, MaxContourOverlap, ClusterThreshold : )

Herror cluster_model_components(const Hobject TrainingImages, Hobject* ModelComponents, const Hlong ComponentTrainingID, const char* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold)

Herror T_cluster_model_components(const Hobject TrainingImages, Hobject* ModelComponents, const Htuple ComponentTrainingID, const Htuple AmbiguityCriterion, const Htuple MaxContourOverlap, const Htuple ClusterThreshold)

void ClusterModelComponents(const HObject& TrainingImages, HObject* ModelComponents, const HTuple& ComponentTrainingID, const HTuple& AmbiguityCriterion, const HTuple& MaxContourOverlap, const HTuple& ClusterThreshold)

HRegion HComponentTraining::ClusterModelComponents(const HImage& TrainingImages, const HString& AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HComponentTraining::ClusterModelComponents(const HImage& TrainingImages, const char* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HImage::ClusterModelComponents(const HComponentTraining& ComponentTrainingID, const HString& AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

HRegion HImage::ClusterModelComponents(const HComponentTraining& ComponentTrainingID, const char* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold) const

static void HOperatorSet.ClusterModelComponents(HObject trainingImages, out HObject modelComponents, HTuple componentTrainingID, HTuple ambiguityCriterion, HTuple maxContourOverlap, HTuple clusterThreshold)

HRegion HComponentTraining.ClusterModelComponents(HImage trainingImages, string ambiguityCriterion, double maxContourOverlap, double clusterThreshold)

HRegion HImage.ClusterModelComponents(HComponentTraining componentTrainingID, string ambiguityCriterion, double maxContourOverlap, double clusterThreshold)

Description

With cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponentsClusterModelComponents you can modify parameters after a first training has been performed using train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents. cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponentsClusterModelComponents sets the criterion AmbiguityCriterionAmbiguityCriterionAmbiguityCriterionAmbiguityCriterionambiguityCriterion that is used to solve the ambiguities, the maximum contour overlap MaxContourOverlapMaxContourOverlapMaxContourOverlapMaxContourOverlapmaxContourOverlap, and the cluster threshold of the training result ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID to the specified values. A detailed description of these parameters can be found in the documentation of train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents. By modifying these parameters, the way in which the initial components are merged into rigid model components changes. For example, the greater the cluster threshold is chosen, the fewer initial components are merged. You can select suitable parameter values interactively by repeatedly calling inspect_clustered_componentsinspect_clustered_componentsInspectClusteredComponentsInspectClusteredComponentsInspectClusteredComponents with different parameter values and then setting the chosen values by using get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsGetTrainingComponents.

The rigid model components are returned in ModelComponentsModelComponentsModelComponentsModelComponentsmodelComponents. In order to receive reasonable results, it is essential that the same training images that were used to perform the training with train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents are passed in TrainingImagesTrainingImagesTrainingImagesTrainingImagestrainingImages. The pose of the newly clustered components within the training images is determined using the shape-based matching. As in train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents, one can decide whether the shape models should be pregenerated by using set_system('pregenerate_shape_models',...)set_system("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...)SetSystem("pregenerate_shape_models",...). Note that, if for a certain pyramid level the model touches the image border, it might not be found even if it lies completely within the original image. set_system('border_shape_models',...)set_system("border_shape_models",...)SetSystem("border_shape_models",...)SetSystem("border_shape_models",...)SetSystem("border_shape_models",...) can be used to determine whether the models must lie completely within the training images or whether they can extend partially beyond the image border.

Execution Information

Parameters

TrainingImagesTrainingImagesTrainingImagesTrainingImagestrainingImages (input_object)  (multichannel-)image(-array) objectHImageHImageHobject (byte / uint2)

Training images that were used for training the model components.

ModelComponentsModelComponentsModelComponentsModelComponentsmodelComponents (output_object)  region(-array) objectHRegionHRegionHobject *

Contour regions of rigid model components.

ComponentTrainingIDComponentTrainingIDComponentTrainingIDComponentTrainingIDcomponentTrainingID (input_control)  component_training HComponentTraining, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

Handle of the training result.

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

Criterion for solving the ambiguities.

Default value: 'rigidity' "rigidity" "rigidity" "rigidity" "rigidity"

List of values: 'distance'"distance""distance""distance""distance", 'distance_orientation'"distance_orientation""distance_orientation""distance_orientation""distance_orientation", 'orientation'"orientation""orientation""orientation""orientation", 'rigidity'"rigidity""rigidity""rigidity""rigidity"

MaxContourOverlapMaxContourOverlapMaxContourOverlapMaxContourOverlapmaxContourOverlap (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Maximum contour overlap of the found initial components.

Default value: 0.2

Suggested values: 0.0, 0.1, 0.2, 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 <= MaxContourOverlap && MaxContourOverlap <= 1

ClusterThresholdClusterThresholdClusterThresholdClusterThresholdclusterThreshold (input_control)  real HTupleHTupleHtuple (real) (double) (double) (double)

Threshold for clustering the initial components.

Default value: 0.5

Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0

Restriction: 0 <= ClusterThreshold && ClusterThreshold <= 1

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$'02'+'.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.5, \
                        ComponentTrainingID)
* Find the best value for the parameter ClusterThreshold.
inspect_clustered_components (ModelComponents, ComponentTrainingID, \
                              'rigidity', 0.2, 0.4)
* Adopt the ClusterThreshold into the training result.
cluster_model_components (TrainingImages, ModelComponents, \
                          ComponentTrainingID, 'rigidity', 0.2, 0.4)
* 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)

Result

If the parameter values are correct, the operator cluster_model_componentscluster_model_componentsClusterModelComponentsClusterModelComponentsClusterModelComponents returns the value 2 (H_MSG_TRUE). If the input is empty (no input images are available) the behavior can be set via set_system('no_object_result',<Result>)set_system("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>)SetSystem("no_object_result",<Result>). If necessary, an exception is raised.

Possible Predecessors

train_model_componentstrain_model_componentsTrainModelComponentsTrainModelComponentsTrainModelComponents, inspect_clustered_componentsinspect_clustered_componentsInspectClusteredComponentsInspectClusteredComponentsInspectClusteredComponents

Possible Successors

get_training_componentsget_training_componentsGetTrainingComponentsGetTrainingComponentsGetTrainingComponents, create_trained_component_modelcreate_trained_component_modelCreateTrainedComponentModelCreateTrainedComponentModelCreateTrainedComponentModel, modify_component_relationsmodify_component_relationsModifyComponentRelationsModifyComponentRelationsModifyComponentRelations, write_training_componentswrite_training_componentsWriteTrainingComponentsWriteTrainingComponentsWriteTrainingComponents, get_component_relationsget_component_relationsGetComponentRelationsGetComponentRelationsGetComponentRelations, clear_training_componentsclear_training_componentsClearTrainingComponentsClearTrainingComponentsClearTrainingComponents

Module

Matching


ClassesClasses | | Operators