set_metrology_model_param
— Set parameters that are valid for the entire metrology model.
set_metrology_model_param( : : MetrologyHandle, GenParamName, GenParamValue : )
set_metrology_model_param
sets or changes parameters that are
valid for the entire metrology model MetrologyHandle
.
For an explanation of the concept of 2D metrology see the introduction of chapter 2D Metrology.
The following values for GenParamName
and GenParamValue
are possible:
If both internal camera parameters and the 3D pose of the measurement plane
are set, apply_metrology_model
calculates the results
in metric coordinates.
Often the internal camera parameters are the result of calibrating
the camera with the operator calibrate_cameras
(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' to [].
Default value: []
The 3D pose of the measurement plane in camera coordinates. It is possible to discard the pose by setting 'plane_pose' to [].
Default value: []
When adding the metrology objects to the metrology model using e.g.,
add_metrology_object_generic
,
add_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_model
can only be directly used in
align_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_model
for more details).
GenParamValue
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) |
Default value: [0, 0, 0]
The results of the measurement queried by
get_metrology_object_result
can be scaled by setting a scaling
factor.
The parameter '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' and '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 |
List of values: 1.0, 0.1, 'm' , 'cm' , 'mm' , 'microns' , 'um'
Default value: 1.0
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.
MetrologyHandle
(input_control, state is modified) metrology_model →
(handle)
Handle of the metrology model.
GenParamName
(input_control) attribute.name →
(string)
Name of the generic parameter.
Default: 'camera_param'
List of values: 'camera_param' , 'plane_pose' , 'reference_system' , 'scale'
GenParamValue
(input_control) attribute.value(-array) →
(string / real / integer)
Value of the generic parameter.
Default: []
Suggested values: 1.0, 0.1, 'm' , 'cm' , 'mm' , 'microns' , 'um'
If the parameters are valid, the operator
set_metrology_model_param
returns the value 2 (
H_MSG_TRUE)
. If
necessary, an exception is raised.
create_metrology_model
,
set_metrology_model_image_size
add_metrology_object_generic
,
get_metrology_object_model_contour
set_metrology_object_param
,
align_metrology_model
,
get_metrology_model_param
2D Metrology