Skip to content

set_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_paramT_set_metrology_model_param🔗

Short description🔗

set_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_paramT_set_metrology_model_param — Set parameters that are valid for the entire metrology model.

Signature🔗

set_metrology_model_param( metrology_model MetrologyHandle, attribute.name GenParamName, attribute.value GenParamValue )void SetMetrologyModelParam( const HTuple& MetrologyHandle, const HTuple& GenParamName, const HTuple& GenParamValue )static void HOperatorSet.SetMetrologyModelParam( HTuple metrologyHandle, HTuple genParamName, HTuple genParamValue )def set_metrology_model_param( metrology_handle: HHandle, gen_param_name: str, gen_param_value: MaybeSequence[Union[str, float, int]] ) -> None

Herror T_set_metrology_model_param( const Htuple MetrologyHandle, const Htuple GenParamName, const Htuple GenParamValue )

void HMetrologyModel::SetMetrologyModelParam( const HString& GenParamName, const HTuple& GenParamValue ) const

void HMetrologyModel::SetMetrologyModelParam( const HString& GenParamName, const HString& GenParamValue ) const

void HMetrologyModel::SetMetrologyModelParam( const char* GenParamName, const char* GenParamValue ) const

void HMetrologyModel::SetMetrologyModelParam( const wchar_t* GenParamName, const wchar_t* GenParamValue ) const (Windows only)

void HMetrologyModel.SetMetrologyModelParam( string genParamName, HTuple genParamValue )

void HMetrologyModel.SetMetrologyModelParam( string genParamName, string genParamValue )

Description🔗

set_metrology_model_paramSetMetrologyModelParam sets or changes parameters that are valid for the entire metrology model MetrologyHandlemetrologyHandlemetrology_handle.

For an explanation of the concept of 2D metrology see the introduction of chapter 2D Metrology.

The following values for GenParamNamegenParamNamegen_param_name and GenParamValuegenParamValuegen_param_value are possible:

Calibration🔗

If both internal camera parameters and the 3D pose of the measurement plane are set, apply_metrology_modelApplyMetrologyModel calculates the results in metric coordinates.

  • 'camera_param'"camera_param": Often the internal camera parameters are the result of calibrating the camera with the operator calibrate_camerasCalibrateCameras (see Calibration for the sequence of the parameters and the underlying camera model). It is possible to discard the internal camera parameters by setting 'camera_param'"camera_param" to [].

    Default: []

  • 'plane_pose'"plane_pose": The 3D pose of the measurement plane in camera coordinates. It is possible to discard the pose by setting 'plane_pose'"plane_pose" to [].

    Default: []

Definition of a new reference system🔗

When adding the metrology objects to the metrology model using e.g., add_metrology_object_genericAddMetrologyObjectGeneric, add_metrology_object_circle_measureAddMetrologyObjectCircleMeasure etc. the positions and orientations are given with respect to the image coordinate system which has its origin in the upper left corner of the image. In some cases it may be necessary to change the reference system with respect to which the metrology objects are given. This is for instance the case when using a shape model to align the metrology model in a new image. The results from find_generic_shape_modelFindGenericShapeModel can only be directly used in align_metrology_modelAlignMetrologyModel if the reference system of the metrology model is the same as the system in which the shape model is given (see align_metrology_modelAlignMetrologyModel for more details).

Scaling the results🔗

The results of the measurement queried by get_metrology_object_resultGetMetrologyObjectResult can be scaled by setting a scaling factor.

  • 'scale'"scale": The parameter 'scale'"scale" must be specified as the ratio of the desired unit to the original unit. If no camera parameters are given, the default unit is pixel.

    If 'camera_param'"camera_param" and 'plane_pose'"plane_pose" are set, the original unit is determined by the coordinates of the calibration object. Standard HALCON calibration plates are defined in metric coordinates. If it was used for the calibration, the desired unit can be set directly. The relation of units to scaling factors is given in the following table:

    Unit Scaling factor
    m 1
    dm 10
    cm 100
    mm 1000
    um, microns 1e6

    Suggested values: 1.01.0, 0.10.1, 'm'"m", 'cm'"cm", 'mm'"mm", 'microns'"microns", 'um'"um"

    Default: 1.01.0

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.

This operator modifies the state of the following input parameter:

During execution of this operator, access to the value of this parameter must be synchronized if it is used across multiple threads.

Parameters🔗

MetrologyHandlemetrologyHandlemetrology_handle (input_control, state is modified) metrology_model → (handle)HTuple (HHandle)HMetrologyModel, HTuple (IntPtr)HHandleHtuple (handle)

Handle of the metrology model.

GenParamNamegenParamNamegen_param_name (input_control) attribute.name → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Name of the generic parameter.

Default: 'camera_param'"camera_param"
List of values: 'camera_param', 'plane_pose', 'reference_system', 'scale'"camera_param", "plane_pose", "reference_system", "scale"

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

Value of the generic parameter.

Default: [][]
Suggested values: 1.0, 0.1, 'm', 'cm', 'mm', 'microns', 'um'1.0, 0.1, "m", "cm", "mm", "microns", "um"

Result🔗

If the parameters are valid, the operator set_metrology_model_paramSetMetrologyModelParam returns the value 2 (H_MSG_TRUE). If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

create_metrology_modelCreateMetrologyModel, set_metrology_model_image_sizeSetMetrologyModelImageSize

Possible successors

add_metrology_object_genericAddMetrologyObjectGeneric, get_metrology_object_model_contourGetMetrologyObjectModelContour

See also

set_metrology_object_paramSetMetrologyObjectParam, align_metrology_modelAlignMetrologyModel, get_metrology_model_paramGetMetrologyModelParam

Module🔗

2D Metrology