ClassesClasses | | Operators

set_metrology_model_paramT_set_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParam (Operator)

Name

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

Signature

set_metrology_model_param( : : MetrologyHandle, GenParamName, GenParamValue : )

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

void SetMetrologyModelParam(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

static void HOperatorSet.SetMetrologyModelParam(HTuple metrologyHandle, HTuple genParamName, HTuple genParamValue)

void HMetrologyModel.SetMetrologyModelParam(string genParamName, HTuple genParamValue)

void HMetrologyModel.SetMetrologyModelParam(string genParamName, string genParamValue)

Description

set_metrology_model_paramset_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamSetMetrologyModelParam sets or changes parameters that are valid for the entire metrology model MetrologyHandleMetrologyHandleMetrologyHandleMetrologyHandlemetrologyHandle.

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

The following values for GenParamNameGenParamNameGenParamNameGenParamNamegenParamName and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue are possible:

Calibration

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

'camera_param'"camera_param""camera_param""camera_param""camera_param":

Often the internal camera parameters are the result of calibrating the camera with the operator calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras (see calibrate_camerascalibrate_camerasCalibrateCamerasCalibrateCamerasCalibrateCameras 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""camera_param""camera_param""camera_param" to [].

Default value: []

'plane_pose'"plane_pose""plane_pose""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""plane_pose""plane_pose""plane_pose" to [].

Default value: []

Definition of a new reference system

When adding the metrology objects to the metrology model using e.g. add_metrology_object_genericadd_metrology_object_genericAddMetrologyObjectGenericAddMetrologyObjectGenericAddMetrologyObjectGeneric, add_metrology_object_circle_measureadd_metrology_object_circle_measureAddMetrologyObjectCircleMeasureAddMetrologyObjectCircleMeasureAddMetrologyObjectCircleMeasure 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_shape_modelfind_shape_modelFindShapeModelFindShapeModelFindShapeModel can only be directly used in align_metrology_modelalign_metrology_modelAlignMetrologyModelAlignMetrologyModelAlignMetrologyModel if the reference system of the metrology model is the same as the system in which the shape model is given (see align_metrology_modelalign_metrology_modelAlignMetrologyModelAlignMetrologyModelAlignMetrologyModel for more details).

'reference_system'"reference_system""reference_system""reference_system""reference_system":

The tuple given in GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue should contain [row, column, angle]. By default the reference system is the image coordinate system which has its origin in the top left corner. A new reference system is defined with respect to the image coordinate system by its translation (row,colum) and its rotation angle (angle). All components of the metrology model are converted into the new reference coordinate system. In the following figure, the reference system of the metrology model is set to the center of the image.

  set_metrology_model_param (MetrologyHandle, 'reference_system', [Height/2,Width/2,0])

(1) (2)
(1) Several metrology objects and their contours are shown in blue. (2) The new reference system for the metrology model is placed in the center of the image. As a consequence, the positions and orientations of the metrology objects are moved into the reverse direction. The resulting contours of the metrology objects are shown in blue.

Default value: [0, 0, 0]

Scaling the results

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

'scale'"scale""scale""scale""scale":

The parameter 'scale'"scale""scale""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""camera_param""camera_param""camera_param" and 'plane_pose'"plane_pose""plane_pose""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
µm, microns 1e6

List of values: 1.0, 0.1, 'm'"m""m""m""m", 'cm'"cm""cm""cm""cm", 'mm'"mm""mm""mm""mm", 'microns'"microns""microns""microns""microns", 'um'"um""um""um""um"

Default value: 1.0

Execution Information

This operator modifies the state of the following input parameter:

The value of this parameter may not be shared across multiple threads without external synchronization.

Parameters

MetrologyHandleMetrologyHandleMetrologyHandleMetrologyHandlemetrologyHandle (input_control, state is modified)  metrology_model HMetrologyModel, HTupleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)

Handle of the metrology model.

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name HTupleHTupleHtuple (string) (string) (HString) (char*)

Name of the generic parameter.

Default value: 'camera_param' "camera_param" "camera_param" "camera_param" "camera_param"

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

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.value(-array) HTupleHTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)

Value of the generic parameter.

Default value: []

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

Result

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

Possible Predecessors

create_metrology_modelcreate_metrology_modelCreateMetrologyModelCreateMetrologyModelCreateMetrologyModel, set_metrology_model_image_sizeset_metrology_model_image_sizeSetMetrologyModelImageSizeSetMetrologyModelImageSizeSetMetrologyModelImageSize

Possible Successors

add_metrology_object_genericadd_metrology_object_genericAddMetrologyObjectGenericAddMetrologyObjectGenericAddMetrologyObjectGeneric, get_metrology_object_model_contourget_metrology_object_model_contourGetMetrologyObjectModelContourGetMetrologyObjectModelContourGetMetrologyObjectModelContour

See also

set_metrology_object_paramset_metrology_object_paramSetMetrologyObjectParamSetMetrologyObjectParamSetMetrologyObjectParam, align_metrology_modelalign_metrology_modelAlignMetrologyModelAlignMetrologyModelAlignMetrologyModel, get_metrology_model_paramget_metrology_model_paramGetMetrologyModelParamGetMetrologyModelParamGetMetrologyModelParam

Module

2D Metrology


ClassesClasses | | Operators