set_metrology_model_paramT_set_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_param (算子)
名称
set_metrology_model_paramT_set_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_param — 设置对整个计量模型有效的参数。
签名
描述
set_metrology_model_paramset_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_param sets or changes parameters that are
valid for the entire metrology model MetrologyHandleMetrologyHandleMetrologyHandleMetrologyHandlemetrologyHandlemetrology_handle。
有关二维计量概念的说明,请参阅 二维计量 一章的引言。
The following values for GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name and GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value
are possible:
Calibration
If both internal camera parameters and the 3D pose of the measurement plane
are set, apply_metrology_modelapply_metrology_modelApplyMetrologyModelApplyMetrologyModelApplyMetrologyModelapply_metrology_model calculates the results
in metric coordinates.
- 'camera_param'"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_camerasCalibrateCamerasCalibrateCamerasCalibrateCamerascalibrate_cameras
(see 标定 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""camera_param" to [].
默认值: []
- 'plane_pose'"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""plane_pose" to [].
默认值: []
Definition of a new reference system
When adding the metrology objects to the metrology model using e.g.,
add_metrology_object_genericadd_metrology_object_genericAddMetrologyObjectGenericAddMetrologyObjectGenericAddMetrologyObjectGenericadd_metrology_object_generic,
add_metrology_object_circle_measureadd_metrology_object_circle_measureAddMetrologyObjectCircleMeasureAddMetrologyObjectCircleMeasureAddMetrologyObjectCircleMeasureadd_metrology_object_circle_measure 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_modelfind_generic_shape_modelFindGenericShapeModelFindGenericShapeModelFindGenericShapeModelfind_generic_shape_model can only be directly used in
align_metrology_modelalign_metrology_modelAlignMetrologyModelAlignMetrologyModelAlignMetrologyModelalign_metrology_model 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_modelAlignMetrologyModelAlignMetrologyModelAlignMetrologyModelalign_metrology_model for more details).
- 'reference_system'"reference_system""reference_system""reference_system""reference_system""reference_system":
-
The tuple given in
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value 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])set_metrology_model_param(MetrologyHandle, "reference_system", [Height/2,Width/2,0])SetMetrologyModelParam(MetrologyHandle, "reference_system", [Height/2,Width/2,0])SetMetrologyModelParam(MetrologyHandle, "reference_system", [Height/2,Width/2,0])SetMetrologyModelParam(MetrologyHandle, "reference_system", [Height/2,Width/2,0])set_metrology_model_param(MetrologyHandle, "reference_system", [Height/2,Width/2,0])
|
默认值: [0, 0, 0]
Scaling the results
The results of the measurement queried by
get_metrology_object_resultget_metrology_object_resultGetMetrologyObjectResultGetMetrologyObjectResultGetMetrologyObjectResultget_metrology_object_result can be scaled by setting a scaling
factor.
- 'scale'"scale""scale""scale""scale""scale":
-
The parameter 'scale'"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""camera_param" and 'plane_pose'"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 |
|
um, microns |
1e6
|
值列表: 1.0, 0.1, 'm'"m""m""m""m""m",
'cm'"cm""cm""cm""cm""cm", 'mm'"mm""mm""mm""mm""mm", 'microns'"microns""microns""microns""microns""microns",
'um'"um""um""um""um""um"
默认值: 1.0
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
此算子修改后续输入参数的状态:
在执行此算子时,若该参数值需在多个线程间使用,则必须对其访问进行同步。
参数
MetrologyHandleMetrologyHandleMetrologyHandleMetrologyHandlemetrologyHandlemetrology_handle (输入控制,状态被修改) metrology_model → HMetrologyModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
计量模型的句柄。
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制) attribute.name → HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Name of the generic parameter.
默认值:
'camera_param'
"camera_param"
"camera_param"
"camera_param"
"camera_param"
"camera_param"
值列表:
'camera_param'"camera_param""camera_param""camera_param""camera_param""camera_param", 'plane_pose'"plane_pose""plane_pose""plane_pose""plane_pose""plane_pose", 'reference_system'"reference_system""reference_system""reference_system""reference_system""reference_system", 'scale'"scale""scale""scale""scale""scale"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制) attribute.value(-array) → HTupleMaybeSequence[Union[str, float, int]]HTupleHtuple (string / real / integer) (string / double / int / long) (HString / double / Hlong) (char* / double / Hlong)
Value of the generic parameter.
默认值:
[]
建议值:
1.0, 0.1, 'm'"m""m""m""m""m", 'cm'"cm""cm""cm""cm""cm", 'mm'"mm""mm""mm""mm""mm", 'microns'"microns""microns""microns""microns""microns", 'um'"um""um""um""um""um"
结果
如果参数有效,算子
set_metrology_model_paramset_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_param 返回值 2 ( H_MSG_TRUE )。如有必要,则抛出异常。
可能的前趋
create_metrology_modelcreate_metrology_modelCreateMetrologyModelCreateMetrologyModelCreateMetrologyModelcreate_metrology_model,
set_metrology_model_image_sizeset_metrology_model_image_sizeSetMetrologyModelImageSizeSetMetrologyModelImageSizeSetMetrologyModelImageSizeset_metrology_model_image_size
可能的后继
add_metrology_object_genericadd_metrology_object_genericAddMetrologyObjectGenericAddMetrologyObjectGenericAddMetrologyObjectGenericadd_metrology_object_generic,
get_metrology_object_model_contourget_metrology_object_model_contourGetMetrologyObjectModelContourGetMetrologyObjectModelContourGetMetrologyObjectModelContourget_metrology_object_model_contour
另见
set_metrology_object_paramset_metrology_object_paramSetMetrologyObjectParamSetMetrologyObjectParamSetMetrologyObjectParamset_metrology_object_param,
align_metrology_modelalign_metrology_modelAlignMetrologyModelAlignMetrologyModelAlignMetrologyModelalign_metrology_model,
get_metrology_model_paramget_metrology_model_paramGetMetrologyModelParamGetMetrologyModelParamGetMetrologyModelParamget_metrology_model_param
模块
二维计量