inspect_clustered_components ( : ModelComponents : ComponentTrainingID, AmbiguityCriterion, MaxContourOverlap, ClusterThreshold : )

Inspect the rigid model components obtained from the training.

inspect_clustered_components creates a representation of the rigid model components based on the training result ComponentTrainingID in form of contour regions. The resulting rigid model components are computed depending on the criterion that is used to solve the ambiguities AmbiguityCriterion, the maximum allowable contour overlap MaxContourOverlap, and the cluster threshold ClusterThreshold (see train_model_components). The cluster threshold, for example, influences the merging of the initial components. The greater the threshold is chosen, the fewer initial components are merged. The determined rigid model components are returned in ModelComponents.

Hence, after the components have been trained once by using train_model_components, inspect_clustered_components can be used to estimate the effect of different values for the parameters AmbiguityCriterion, MaxContourOverlap, and ClusterThreshold without performing the complete training procedure several times. Once the desired parameter values have been found, they can be efficiently adopted into the training result by using cluster_model_components.


Parameters

ModelComponents (output_object)
region(-array) -> object
Contour regions of rigid model components.

ComponentTrainingID (input_control)
component_training -> integer
Handle of the training result.

AmbiguityCriterion (input_control)
string -> string
Criterion for solving the ambiguities.
Default value: 'rigidity'
List of values: 'distance', 'orientation', 'distance_orientation', 'rigidity'

MaxContourOverlap (input_control)
real -> real
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)

ClusterThreshold (input_control)
real -> real
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
* 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)
InitialComponentRegions := [InitialComponentRegions,Rectangle2]
InitialComponentRegions := [InitialComponentRegions,Rectangle3]
InitialComponentRegions := [InitialComponentRegions,Rectangle4]
* Get the training images
TrainingImages := []
for i := 1 to 4 by 1
    read_image (TrainingImage, 'training_image-'+i$'02'+'.tif')
    TrainingImages := [TrainingImages,TrainingImage]
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 (ModelComponents, 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 handle of the training result is valid, the operator inspect_clustered_components returns the value 2 (H_MSG_TRUE). If necessary an exception is raised.


Parallelization Information

inspect_clustered_components is reentrant and processed without parallelization.


Possible Predecessors

train_model_components


Possible Successors

cluster_model_components


Module

Matching



Copyright © 1996-2008 MVTec Software GmbH