Skip to content

cluster_model_componentsClusterModelComponentsClusterModelComponentscluster_model_componentsT_cluster_model_components🔗

Short description🔗

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

Warning🔗

cluster_model_componentsClusterModelComponents is obsolete and is only provided for reasons of backward compatibility. The operator will be removed with HALCON 26.11.

Signature🔗

cluster_model_components( image TrainingImages, out region ModelComponents, component_training ComponentTrainingID, string AmbiguityCriterion, real MaxContourOverlap, real ClusterThreshold )void ClusterModelComponents( const HObject& TrainingImages, HObject* ModelComponents, const HTuple& ComponentTrainingID, const HTuple& AmbiguityCriterion, const HTuple& MaxContourOverlap, const HTuple& ClusterThreshold )static void HOperatorSet.ClusterModelComponents( HObject trainingImages, out HObject modelComponents, HTuple componentTrainingID, HTuple ambiguityCriterion, HTuple maxContourOverlap, HTuple clusterThreshold )def cluster_model_components( training_images: HObject, component_training_id: HHandle, ambiguity_criterion: str, max_contour_overlap: float, cluster_threshold: float ) -> HObject

Herror T_cluster_model_components( 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 HComponentTraining::ClusterModelComponents( const HImage& TrainingImages, const wchar_t* AmbiguityCriterion, double MaxContourOverlap, double ClusterThreshold ) const (Windows only)

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

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

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_componentsClusterModelComponents you can modify parameters after a first training has been performed using train_model_componentsTrainModelComponents. cluster_model_componentsClusterModelComponents sets the criterion AmbiguityCriterionambiguityCriterionambiguity_criterion that is used to solve the ambiguities, the maximum contour overlap MaxContourOverlapmaxContourOverlapmax_contour_overlap, and the cluster threshold of the training result ComponentTrainingIDcomponentTrainingIDcomponent_training_id to the specified values. A detailed description of these parameters can be found in the documentation of train_model_componentsTrainModelComponents. 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_componentsInspectClusteredComponents with different parameter values and then setting the chosen values by using get_training_componentsGetTrainingComponents.

The rigid model components are returned in ModelComponentsmodelComponentsmodel_components. In order to receive reasonable results, it is essential that the same training images that were used to perform the training with train_model_componentsTrainModelComponents are passed in TrainingImagestrainingImagestraining_images. The pose of the newly clustered components within the training images is determined using the shape-based matching. As in train_model_componentsTrainModelComponents, one can decide whether the shape models should be pregenerated by using set_system('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',...) 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🔗

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🔗

TrainingImagestrainingImagestraining_images (input_object) (multichannel-)image(-array) → object (byte / uint2)HObject (byte / uint2)HImage (byte / uint2)HObject (byte / uint2)Hobject (byte / uint2)

Training images that were used for training the model components.

ModelComponentsmodelComponentsmodel_components (output_object) region(-array) → objectHObjectHRegionHObjectHobject *

Contour regions of rigid model components.

ComponentTrainingIDcomponentTrainingIDcomponent_training_id (input_control) component_training → (handle)HTuple (HHandle)HComponentTraining, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the training result.

AmbiguityCriterionambiguityCriterionambiguity_criterion (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Criterion for solving the ambiguities.

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

MaxContourOverlapmaxContourOverlapmax_contour_overlap (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Maximum contour overlap of the found initial components.

Default: 0.20.2
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.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

ClusterThresholdclusterThresholdcluster_threshold (input_control) real → (real)HTuple (double)HTuple (double)floatHtuple (double)

Threshold for clustering the initial components.

Default: 0.50.5
Suggested values: 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.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

Result🔗

If the parameter values are correct, the operator cluster_model_componentsClusterModelComponents 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>). If necessary, an exception is raised.

Module🔗

Matching