Skip to content

determine_deformable_model_paramsDetermineDeformableModelParamsDetermineDeformableModelParamsdetermine_deformable_model_paramsT_determine_deformable_model_params🔗

Short description🔗

determine_deformable_model_paramsDetermineDeformableModelParamsDetermineDeformableModelParamsdetermine_deformable_model_paramsT_determine_deformable_model_params — Determine the parameters of a deformable model.

Signature🔗

determine_deformable_model_params( image Template, integer NumLevels, angle.rad AngleStart, angle.rad AngleExtent, number ScaleMin, number ScaleMax, string Optimization, string Metric, number Contrast, number MinContrast, string GenParamName, number GenParamValue, string Parameters, out string ParameterName, out number ParameterValue )void DetermineDeformableModelParams( const HObject& Template, const HTuple& NumLevels, const HTuple& AngleStart, const HTuple& AngleExtent, const HTuple& ScaleMin, const HTuple& ScaleMax, const HTuple& Optimization, const HTuple& Metric, const HTuple& Contrast, const HTuple& MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue, const HTuple& Parameters, HTuple* ParameterName, HTuple* ParameterValue )static void HOperatorSet.DetermineDeformableModelParams( HObject template, HTuple numLevels, HTuple angleStart, HTuple angleExtent, HTuple scaleMin, HTuple scaleMax, HTuple optimization, HTuple metric, HTuple contrast, HTuple minContrast, HTuple genParamName, HTuple genParamValue, HTuple parameters, out HTuple parameterName, out HTuple parameterValue )def determine_deformable_model_params( template: HObject, num_levels: Union[int, str], angle_start: float, angle_extent: float, scale_min: MaybeSequence[float], scale_max: MaybeSequence[float], optimization: str, metric: str, contrast: MaybeSequence[Union[int, str]], min_contrast: Union[int, str], gen_param_name: Sequence[str], gen_param_value: Sequence[Union[int, float, str]], parameters: MaybeSequence[str] ) -> Tuple[Sequence[str], Sequence[Union[int, float]]]

Herror T_determine_deformable_model_params( const Hobject Template, const Htuple NumLevels, const Htuple AngleStart, const Htuple AngleExtent, const Htuple ScaleMin, const Htuple ScaleMax, const Htuple Optimization, const Htuple Metric, const Htuple Contrast, const Htuple MinContrast, const Htuple GenParamName, const Htuple GenParamValue, const Htuple Parameters, Htuple* ParameterName, Htuple* ParameterValue )

HTuple HImage::DetermineDeformableModelParams( const HTuple& NumLevels, double AngleStart, double AngleExtent, const HTuple& ScaleMin, const HTuple& ScaleMax, const HString& Optimization, const HString& Metric, const HTuple& Contrast, const HTuple& MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue, const HTuple& Parameters, HTuple* ParameterValue ) const

HTuple HImage::DetermineDeformableModelParams( Hlong NumLevels, double AngleStart, double AngleExtent, double ScaleMin, double ScaleMax, const HString& Optimization, const HString& Metric, Hlong Contrast, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue, const HString& Parameters, HTuple* ParameterValue ) const

HTuple HImage::DetermineDeformableModelParams( Hlong NumLevels, double AngleStart, double AngleExtent, double ScaleMin, double ScaleMax, const char* Optimization, const char* Metric, Hlong Contrast, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue, const char* Parameters, HTuple* ParameterValue ) const

HTuple HImage::DetermineDeformableModelParams( Hlong NumLevels, double AngleStart, double AngleExtent, double ScaleMin, double ScaleMax, const wchar_t* Optimization, const wchar_t* Metric, Hlong Contrast, Hlong MinContrast, const HTuple& GenParamName, const HTuple& GenParamValue, const wchar_t* Parameters, HTuple* ParameterValue ) const (Windows only)

HTuple HImage.DetermineDeformableModelParams( HTuple numLevels, double angleStart, double angleExtent, HTuple scaleMin, HTuple scaleMax, string optimization, string metric, HTuple contrast, HTuple minContrast, HTuple genParamName, HTuple genParamValue, HTuple parameters, out HTuple parameterValue )

HTuple HImage.DetermineDeformableModelParams( int numLevels, double angleStart, double angleExtent, double scaleMin, double scaleMax, string optimization, string metric, int contrast, int minContrast, HTuple genParamName, HTuple genParamValue, string parameters, out HTuple parameterValue )

Description🔗

determine_deformable_model_paramsDetermineDeformableModelParams determines certain parameters of a deformable model automatically from the model image Templatetemplatetemplate. The parameters to be determined can be specified with Parametersparametersparameters. determine_deformable_model_paramsDetermineDeformableModelParams can be used to determine the same parameters that are determined automatically when the respective parameter in create_planar_uncalib_deformable_modelCreatePlanarUncalibDeformableModel is set to 'auto'"auto": the number of pyramid levels (Parametersparametersparameters \(=\) 'num_levels'"num_levels"), the angle step length (Parametersparametersparameters \(=\) 'angle_step'"angle_step"), the scale step length (Parametersparametersparameters \(=\) 'scale_step'"scale_step" for isotropic scaling and 'scale_r_step'"scale_r_step" and/or 'scale_c_step'"scale_c_step" for anisotropic scaling), the kind of optimization (Parametersparametersparameters \(=\) 'optimization'"optimization"), the threshold (Parametersparametersparameters \(=\) 'contrast'"contrast") or the hysteresis thresholds (Parametersparametersparameters \(=\) 'contrast_hyst'"contrast_hyst") for the contrast, the minimum size of the object parts (Parametersparametersparameters \(=\) 'min_size'"min_size"), and the minimum contrast (Parametersparametersparameters \(=\) 'min_contrast'"min_contrast"). By passing a tuple of the above values in Parametersparametersparameters, an arbitrary combination of these parameters can be determined. If all of the above parameters should be determined, the value 'all'"all" can be passed. In this case both hysteresis thresholds are determined, i.e., the operator behaves like passing 'contrast_hyst'"contrast_hyst" instead of 'contrast'"contrast".

determine_deformable_model_paramsDetermineDeformableModelParams is mainly useful to determine the above parameters before creating the model, e.g., in an interactive system, which makes suggestions for these parameters to the user, but enables the user to modify the suggested values.

The automatically determined parameters are returned as a name-value pair in ParameterNameparameterNameparameter_name and ParameterValueparameterValueparameter_value. The parameter names in ParameterNameparameterNameparameter_name are identical to the names in Parametersparametersparameters, where, of course, the value 'all'"all" is replaced by the actual parameter names. An exception is the parameter 'contrast_hyst'"contrast_hyst", for which the two values 'contrast_low'"contrast_low" and 'contrast_high'"contrast_high" are returned.

The remaining parameters (NumLevelsnumLevelsnum_levels, AngleStartangleStartangle_start, AngleExtentangleExtentangle_extent, ScaleMinscaleMinscale_min, ScaleMaxscaleMaxscale_max, Optimizationoptimizationoptimization, Metricmetricmetric, Contrastcontrastcontrast, and MinContrastminContrastmin_contrast) have the same meaning as in create_planar_uncalib_deformable_modelCreatePlanarUncalibDeformableModel and find_planar_uncalib_deformable_modelFindPlanarUncalibDeformableModel. The description of these parameters can be looked up with these operators. These parameters are used by determine_deformable_model_paramsDetermineDeformableModelParams to calculate the parameters to be determined in the same manner as in create_planar_uncalib_deformable_modelCreatePlanarUncalibDeformableModel. It should be noted that if the parameters of a deformable model with isotropic scaling should be determined, i.e., if Parametersparametersparameters contains 'scale_step'"scale_step" either explicitly or implicitly via 'all'"all", the parameters ScaleMinscaleMinscale_min and ScaleMaxscaleMaxscale_max must contain one value each. If the parameters of a deformable model with anisotropic scaling should be determined, i.e., if Parametersparametersparameters contains 'scale_r_step'"scale_r_step" or 'scale_c_step'"scale_c_step" either explicitly or implicitly, the parameters ScaleMinscaleMinscale_min and ScaleMaxscaleMaxscale_max must contain two values each. In this case, the first value of the respective parameter refers to the scaling in row direction, while the second value refers to scaling in the column direction.

Note that in determine_deformable_model_paramsDetermineDeformableModelParams some parameters appear that can also be determined automatically (NumLevelsnumLevelsnum_levels, Optimizationoptimizationoptimization, Contrastcontrastcontrast, MinContrastminContrastmin_contrast). If these parameters should not be determined automatically, i.e., their name is not passed in ParameterNameparameterNameparameter_name, the corresponding parameters must contain valid values and must not be set to 'auto'"auto". In contrast, if these parameters are to be determined automatically, their values are treated in the following way: If the optimization or the (hysteresis) contrast is to be determined automatically, i.e., ParameterNameparameterNameparameter_name contains the value 'optimization'"optimization" or 'contrast'"contrast" ('contrast_hyst'"contrast_hyst"), the values passed in Optimizationoptimizationoptimization and Contrastcontrastcontrast are ignored. In contrast, if the maximum number of pyramid levels or the minimum contrast is to be determined automatically, i.e., ParameterNameparameterNameparameter_name contains the value 'num_levels'"num_levels" or 'min_contrast'"min_contrast", you can let HALCON determine suitable values and at the same time specify an upper or lower boundary, respectively:

If the maximum number of pyramid levels should be specified in advance, NumLevelsnumLevelsnum_levels can be set to the particular value. If in this case Parametersparametersparameters contains the value 'num_levels'"num_levels", the computed number of pyramid levels is at most NumLevelsnumLevelsnum_levels. If NumLevelsnumLevelsnum_levels is set to 'auto'"auto" (or 00 for backwards compatibility), the number of pyramid levels is determined without restrictions as large as possible.

If the minimum contrast should be specified in advance, MinContrastminContrastmin_contrast can be set to the particular value. If in this case Parametersparametersparameters contains the value 'min_contrast'"min_contrast", the computed minimum contrast is at least MinContrastminContrastmin_contrast. If MinContrastminContrastmin_contrast is set to 'auto'"auto", the minimum contrast is determined without restrictions.

If the user wishes to create a calibrated, deformable model with create_planar_calib_deformable_modelCreatePlanarCalibDeformableModel, the internal camera parameters are needed for the correct estimation of the parameters in ParameterValueparameterValueparameter_value. The camera parameters can be provided by setting GenParamNamegenParamNamegen_param_name to 'cam_param'"cam_param" and providing the tuple containing the camera parameters in GenParamValuegenParamValuegen_param_value.

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🔗

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

Input image whose domain will be used to create the model.

NumLevelsnumLevelsnum_levels (input_control) integer → (integer / string)HTuple (Hlong / HString)HTuple (int / long / string)Union[int, str]Htuple (Hlong / char*)

Maximum number of pyramid levels.

Default: 'auto'"auto"
List of values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 'auto'0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "auto"

AngleStartangleStartangle_start (input_control) angle.rad → (real)HTuple (double)HTuple (double)floatHtuple (double)

Smallest rotation of the model.

Default: -0.39-0.39
Suggested values: -3.14, -1.57, -0.79, -0.39, -0.20, 0.0-3.14, -1.57, -0.79, -0.39, -0.20, 0.0

AngleExtentangleExtentangle_extent (input_control) angle.rad → (real)HTuple (double)HTuple (double)floatHtuple (double)

Extent of the rotation angles.

Default: 0.790.79
Suggested values: 6.28, 3.14, 1.57, 0.79, 0.396.28, 3.14, 1.57, 0.79, 0.39
Restriction: AngleExtent >= 0

ScaleMinscaleMinscale_min (input_control) number(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

Minimum scale of the model.

Default: 0.90.9
Suggested values: 0.5, 0.6, 0.7, 0.8, 0.9, 1.00.5, 0.6, 0.7, 0.8, 0.9, 1.0
Restriction: ScaleMin > 0

ScaleMaxscaleMaxscale_max (input_control) number(-array) → (real)HTuple (double)HTuple (double)MaybeSequence[float]Htuple (double)

Maximum scale of the model.

Default: 1.11.1
Suggested values: 1.0, 1.1, 1.2, 1.3, 1.4, 1.51.0, 1.1, 1.2, 1.3, 1.4, 1.5
Restriction: ScaleMax >= ScaleMin

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

Kind of optimization.

Default: 'auto'"auto"
List of values: 'auto', 'none', 'point_reduction_high', 'point_reduction_low', 'point_reduction_medium'"auto", "none", "point_reduction_high", "point_reduction_low", "point_reduction_medium"

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

Match metric.

Default: 'use_polarity'"use_polarity"
List of values: 'ignore_color_polarity', 'ignore_global_polarity', 'ignore_local_polarity', 'use_polarity'"ignore_color_polarity", "ignore_global_polarity", "ignore_local_polarity", "use_polarity"

Contrastcontrastcontrast (input_control) number(-array) → (integer / string)HTuple (Hlong / HString)HTuple (int / long / string)MaybeSequence[Union[int, str]]Htuple (Hlong / char*)

Threshold or hysteresis thresholds for the contrast of the object in the template image and optionally minimum size of the object parts.

Default: 'auto'"auto"
Suggested values: 'auto', 'auto_contrast', 'auto_contrast_hyst', 'auto_min_size', 10, 20, 30, 40, 60, 80, 100, 120, 140, 160"auto", "auto_contrast", "auto_contrast_hyst", "auto_min_size", 10, 20, 30, 40, 60, 80, 100, 120, 140, 160

MinContrastminContrastmin_contrast (input_control) number → (integer / string)HTuple (Hlong / HString)HTuple (int / long / string)Union[int, str]Htuple (Hlong / char*)

Minimum contrast of the objects in the search images.

Default: 'auto'"auto"
Suggested values: 'auto', 1, 2, 3, 5, 7, 10, 20, 30, 40"auto", 1, 2, 3, 5, 7, 10, 20, 30, 40
Restriction: MinContrast < Contrast

GenParamNamegenParamNamegen_param_name (input_control) string-array → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

The general parameter names.

Default: [][]
List of values: 'cam_param'"cam_param"

GenParamValuegenParamValuegen_param_value (input_control) number-array → (real / integer / string)HTuple (double / Hlong / HString)HTuple (double / int / long / string)Sequence[Union[int, float, str]]Htuple (double / Hlong / char*)

Values of the general parameter.

Default: [][]
List of values: [][]

Parametersparametersparameters (input_control) string(-array) → (string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Parameters to be determined automatically.

Default: 'all'"all"
List of values: 'all', 'angle_step', 'contrast', 'contrast_hyst', 'min_contrast', 'min_size', 'num_levels', 'optimization', 'scale_c_step', 'scale_r_step', 'scale_step'"all", "angle_step", "contrast", "contrast_hyst", "min_contrast", "min_size", "num_levels", "optimization", "scale_c_step", "scale_r_step", "scale_step"

ParameterNameparameterNameparameter_name (output_control) string-array → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Name of the automatically determined parameter.

ParameterValueparameterValueparameter_value (output_control) number-array → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Sequence[Union[int, float]]Htuple (double / Hlong)

Value of the automatically determined parameter.

Result🔗

If the parameters are valid, the operator determine_deformable_model_paramsDetermineDeformableModelParams returns the value 2 (H_MSG_TRUE). If necessary an exception is raised. If the parameters NumLevelsnumLevelsnum_levels and Contrastcontrastcontrast are chosen such that the model contains too few points, or the input image does not contain a sufficient number of significant features, the error message 8510 is raised.

Combinations with other operators🔗

Combinations

Possible successors

create_planar_uncalib_deformable_modelCreatePlanarUncalibDeformableModel, create_planar_calib_deformable_modelCreatePlanarCalibDeformableModel, create_local_deformable_modelCreateLocalDeformableModel

See also

find_planar_uncalib_deformable_modelFindPlanarUncalibDeformableModel, find_planar_calib_deformable_modelFindPlanarCalibDeformableModel

Module🔗

Matching