2D Metrology
List of Operators ↓
This chapter contains operators for 2D metrology.
Concept of 2D Metrology
With 2D metrology, you can measure the dimensions of objects that can be
represented by specific geometric primitives. The geometric shapes that can
be measured comprise circles, ellipses, rectangles, and lines. You need
approximate values for the positions, orientations, and dimensions of the
objects to measure. Then, the real edge positions of the objects in the image
are located near the boundaries of the approximate objects. With these edge
positions, the parameters of the geometric shapes are optimized to better fit
to the image data and are returned as measurement result.
The approximate values for the shape parameters of an object as well as some
parameters that control the measurement are stored in a data structure that
is called metrology object. The edges of the object in the image are located
within socalled measure regions. These are rectangular regions that are
arranged perpendicular to the boundaries of the metrology objects. Parameters
that adjust the dimension and distribution of the measure regions are
specified together with the approximate shape parameters for each metrology
object. When the measurement is applied, the edge positions inside all
measure regions are determined and fitted to geometric shapes using a RANSAC
algorithm. All metrology objects, all further information that is necessary
for the measurement, and the measurement results are stored in a data
structure that is called metrology model.
In the following, the steps that are required to use 2D metrology are
described briefly.
 Create the metrology model and specify the image size:

First, a metrology model must be created using
The metrology model is used as a container for one or more metrology
objects. For an efficient measurement, after creating the metrology
model, the image size of the image in which the measurements will be
performed should be specified using
 Provide approximate values:

Then, metrology objects are added to the metrology model. Each
metrology object consists of the approximate shape parameters for the
corresponding object in the image and of the parameters that control
the measurement. The parameters that control the measurement
comprise, e.g., parameters that specify the dimension and distribution of
the measure regions. Furthermore, several generic parameters can be
adjusted for each metrology object. The metrology objects are
specified with
To visually inspect the defined metrology objects, you can access
their XLD contours with the operator
get_metrology_object_model_contourget_metrology_object_model_contourGetMetrologyObjectModelContourget_metrology_object_model_contourGetMetrologyObjectModelContourGetMetrologyObjectModelContour. To visually inspect the
created measure regions, you can access their XLD contours with the
operator get_metrology_object_measuresget_metrology_object_measuresGetMetrologyObjectMeasuresget_metrology_object_measuresGetMetrologyObjectMeasuresGetMetrologyObjectMeasures.
 Modify the model parameters:

If a camera calibration has been performed, the camera parameters and
the pose of the measurement plane can be set with
Then, the result of the measurements returned by
get_metrology_object_resultget_metrology_object_resultGetMetrologyObjectResultget_metrology_object_resultGetMetrologyObjectResultGetMetrologyObjectResult will be in world coordinates. The
reference coordinate system in which the metrology objects are
defined can also be changed with set_metrology_model_paramset_metrology_model_paramSetMetrologyModelParamset_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParam.
 Modify object parameters:

Many parameters can be set when adding the metrology objects to the
metrology model. Some of them can also be modified afterwards using
the operator
 Align the metrology model:

To translate and rotate the metrology model before the next
measurement is performed, you can use the operator
An alignment is temporary and is replaced by the next
alignment. The metrology model itself is not changed. Note that
typically the alignment parameters are obtained using shapebased
matching.
 Apply the measurement:

The actual measurement in the image is performed with
The operator locates the edges within the measure regions and fits
the specified geometric shape to the edge positions using a RANSAC
algorithm. The edges are located internally using the operator
measure_posmeasure_posMeasurePosmeasure_posMeasurePosMeasurePos or fuzzy_measure_posfuzzy_measure_posFuzzyMeasurePosfuzzy_measure_posFuzzyMeasurePosFuzzyMeasurePos (see also chapter
1D Measuring). The latter uses fuzzy
methods and is used only if at least one fuzzy function was set via
set_metrology_object_fuzzy_paramset_metrology_object_fuzzy_paramSetMetrologyObjectFuzzyParamset_metrology_object_fuzzy_paramSetMetrologyObjectFuzzyParamSetMetrologyObjectFuzzyParam before applying the
measurement. If more than one instance of the returned object
shape is needed (compare image above), the generic parameter
'num_instances'"num_instances""num_instances""num_instances""num_instances""num_instances" must be set to the number of instances
that should be returned. The parameter can be set when adding the
individual metrology objects or afterwards with the operator
set_metrology_object_paramset_metrology_object_paramSetMetrologyObjectParamset_metrology_object_paramSetMetrologyObjectParamSetMetrologyObjectParam.
 Access the results:

After the measurement, the results can be accessed. The parameters
of the adapted geometric shapes of the objects are queried with
the operator
Querying only the edges used for the returned result and their
amplitudes is also done using get_metrology_object_resultget_metrology_object_resultGetMetrologyObjectResultget_metrology_object_resultGetMetrologyObjectResultGetMetrologyObjectResult.
The row and column coordinates of all located edges can be
accessed with
To visualize the adapted geometric shapes, you can access their
XLD contours with
 Destroy metrology object handle:

When you no longer need the metrology model, you destroy it by
passing the handle to
Further operators
In addition to the operators mentioned above, you can copy the metrology
handle with copy_metrology_modelcopy_metrology_modelCopyMetrologyModelcopy_metrology_modelCopyMetrologyModelCopyMetrologyModel, write the metrology model to file
with write_metrology_modelwrite_metrology_modelWriteMetrologyModelwrite_metrology_modelWriteMetrologyModelWriteMetrologyModel, read a model from file again using
read_metrology_modelread_metrology_modelReadMetrologyModelread_metrology_modelReadMetrologyModelReadMetrologyModel, and serialize or deserialize a metrology model
using serialize_metrology_modelserialize_metrology_modelSerializeMetrologyModelserialize_metrology_modelSerializeMetrologyModelSerializeMetrologyModel or
deserialize_metrology_modeldeserialize_metrology_modelDeserializeMetrologyModeldeserialize_metrology_modelDeserializeMetrologyModelDeserializeMetrologyModel.
Furthermore, you can query various information from the metrology model. For
example, you can query the indices of the metrology objects with
get_metrology_object_indicesget_metrology_object_indicesGetMetrologyObjectIndicesget_metrology_object_indicesGetMetrologyObjectIndicesGetMetrologyObjectIndices, query parameters that are valid for the
entire metrology model with get_metrology_model_paramget_metrology_model_paramGetMetrologyModelParamget_metrology_model_paramGetMetrologyModelParamGetMetrologyModelParam, query a fuzzy
parameter of a metrology model with get_metrology_object_fuzzy_paramget_metrology_object_fuzzy_paramGetMetrologyObjectFuzzyParamget_metrology_object_fuzzy_paramGetMetrologyObjectFuzzyParamGetMetrologyObjectFuzzyParam,
query the number of instances of the metrology objects of a metrology model
with get_metrology_object_num_instancesget_metrology_object_num_instancesGetMetrologyObjectNumInstancesget_metrology_object_num_instancesGetMetrologyObjectNumInstancesGetMetrologyObjectNumInstances, and query the current
configuration of the metrology model with
get_metrology_object_paramget_metrology_object_paramGetMetrologyObjectParamget_metrology_object_paramGetMetrologyObjectParamGetMetrologyObjectParam.
Additionally, you can reset all parameters of a metrology model using
reset_metrology_object_paramreset_metrology_object_paramResetMetrologyObjectParamreset_metrology_object_paramResetMetrologyObjectParamResetMetrologyObjectParam or reset only all fuzzy parameters and fuzzy
functions of a metrology model using
reset_metrology_object_fuzzy_paramreset_metrology_object_fuzzy_paramResetMetrologyObjectFuzzyParamreset_metrology_object_fuzzy_paramResetMetrologyObjectFuzzyParamResetMetrologyObjectFuzzyParam.
Glossary
In the following, the most important terms that are used in the context of 2D
Metrology are described.
 metrology model

Data structure that contains all metrology objects, all information
needed for the measurement, and the measurement results.
 metrology object

Data structure for the object to be measured with 2D metrology. The
metrology object is represented by a specific geometric shape for
which the shape parameters are approximately known. Additionally, it
contains parameters that control the measurement, e.g., parameters
that specify the dimension and distribution of the measure regions.
 measure regions

Rectangular regions that are arranged perpendicular to the
boundaries of the approximate objects. Within these regions the
edges that are used to get the exact shape parameters of the
metrology objects are extracted.
 returned instance of a metrology object

For each metrology object, different instances of the object can be
returned by the measurement, e.g., if parallel structures of the
same shape exist near to the boundaries of the approximated
geometric shape (see image above). The sequence of the returned
instances is arbitrary, i.e., it is no measure for the quality of
the fitting.
Further Information
See also the “Solution Guide on 2D Measuring” for further details
about 2D metrology.
List of Operators
 add_metrology_object_circle_measureAddMetrologyObjectCircleMeasureAddMetrologyObjectCircleMeasureadd_metrology_object_circle_measureAddMetrologyObjectCircleMeasureadd_metrology_object_circle_measure
 Add a circle or a circular arc to a metrology model.
 add_metrology_object_ellipse_measureAddMetrologyObjectEllipseMeasureAddMetrologyObjectEllipseMeasureadd_metrology_object_ellipse_measureAddMetrologyObjectEllipseMeasureadd_metrology_object_ellipse_measure
 Add an ellipse or an elliptic arc to a metrology model.
 add_metrology_object_genericAddMetrologyObjectGenericAddMetrologyObjectGenericadd_metrology_object_genericAddMetrologyObjectGenericadd_metrology_object_generic
 Add a metrology object to a metrology model.
 add_metrology_object_line_measureAddMetrologyObjectLineMeasureAddMetrologyObjectLineMeasureadd_metrology_object_line_measureAddMetrologyObjectLineMeasureadd_metrology_object_line_measure
 Add a line to a metrology model.
 add_metrology_object_rectangle2_measureAddMetrologyObjectRectangle2MeasureAddMetrologyObjectRectangle2Measureadd_metrology_object_rectangle2_measureAddMetrologyObjectRectangle2Measureadd_metrology_object_rectangle2_measure
 Add a rectangle to a metrology model.
 align_metrology_modelAlignMetrologyModelAlignMetrologyModelalign_metrology_modelAlignMetrologyModelalign_metrology_model
 Alignment of a metrology model.
 apply_metrology_modelApplyMetrologyModelApplyMetrologyModelapply_metrology_modelApplyMetrologyModelapply_metrology_model
 Measure and fit the geometric shapes of all metrology objects of
a metrology model.
 clear_metrology_modelClearMetrologyModelClearMetrologyModelclear_metrology_modelClearMetrologyModelclear_metrology_model
 Delete a metrology model and free the allocated memory.
 clear_metrology_objectClearMetrologyObjectClearMetrologyObjectclear_metrology_objectClearMetrologyObjectclear_metrology_object
 Delete metrology objects and free the allocated memory.
 copy_metrology_modelCopyMetrologyModelCopyMetrologyModelcopy_metrology_modelCopyMetrologyModelcopy_metrology_model
 Copy a metrology model.
 create_metrology_modelCreateMetrologyModelCreateMetrologyModelcreate_metrology_modelCreateMetrologyModelcreate_metrology_model
 Create the data structure that is needed to measure geometric shapes.
 deserialize_metrology_modelDeserializeMetrologyModelDeserializeMetrologyModeldeserialize_metrology_modelDeserializeMetrologyModeldeserialize_metrology_model
 Deserialize a serialized metrology model.
 get_metrology_model_paramGetMetrologyModelParamGetMetrologyModelParamget_metrology_model_paramGetMetrologyModelParamget_metrology_model_param
 Get parameters that are valid for the entire metrology model.
 get_metrology_object_fuzzy_paramGetMetrologyObjectFuzzyParamGetMetrologyObjectFuzzyParamget_metrology_object_fuzzy_paramGetMetrologyObjectFuzzyParamget_metrology_object_fuzzy_param
 Get a fuzzy parameter of a metroloy model.
 get_metrology_object_indicesGetMetrologyObjectIndicesGetMetrologyObjectIndicesget_metrology_object_indicesGetMetrologyObjectIndicesget_metrology_object_indices
 Get the indices of the metrology objects of a metrology model.
 get_metrology_object_measuresGetMetrologyObjectMeasuresGetMetrologyObjectMeasuresget_metrology_object_measuresGetMetrologyObjectMeasuresget_metrology_object_measures
 Get the measure regions and the results of the edge location for the
metrology objects of a metrology model.
 get_metrology_object_model_contourGetMetrologyObjectModelContourGetMetrologyObjectModelContourget_metrology_object_model_contourGetMetrologyObjectModelContourget_metrology_object_model_contour
 Query the model contour of a metrology object in image coordinates.
 get_metrology_object_num_instancesGetMetrologyObjectNumInstancesGetMetrologyObjectNumInstancesget_metrology_object_num_instancesGetMetrologyObjectNumInstancesget_metrology_object_num_instances
 Get the number of instances of the metrology objects of a metrology model.
 get_metrology_object_paramGetMetrologyObjectParamGetMetrologyObjectParamget_metrology_object_paramGetMetrologyObjectParamget_metrology_object_param
 Get one or several parameters of a metroloy model.
 get_metrology_object_resultGetMetrologyObjectResultGetMetrologyObjectResultget_metrology_object_resultGetMetrologyObjectResultget_metrology_object_result
 Get the results of the measurement of a metrology model.
 get_metrology_object_result_contourGetMetrologyObjectResultContourGetMetrologyObjectResultContourget_metrology_object_result_contourGetMetrologyObjectResultContourget_metrology_object_result_contour
 Query the result contour of a metrology object.
 read_metrology_modelReadMetrologyModelReadMetrologyModelread_metrology_modelReadMetrologyModelread_metrology_model
 Read a metrology model from a file.
 reset_metrology_object_fuzzy_paramResetMetrologyObjectFuzzyParamResetMetrologyObjectFuzzyParamreset_metrology_object_fuzzy_paramResetMetrologyObjectFuzzyParamreset_metrology_object_fuzzy_param
 Reset all fuzzy parameters and fuzzy functions of a metrology
model.
 reset_metrology_object_paramResetMetrologyObjectParamResetMetrologyObjectParamreset_metrology_object_paramResetMetrologyObjectParamreset_metrology_object_param
 Reset all parameters of a metrology model.
 serialize_metrology_modelSerializeMetrologyModelSerializeMetrologyModelserialize_metrology_modelSerializeMetrologyModelserialize_metrology_model
 Serialize a metrology model.
 set_metrology_model_image_sizeSetMetrologyModelImageSizeSetMetrologyModelImageSizeset_metrology_model_image_sizeSetMetrologyModelImageSizeset_metrology_model_image_size
 Set the size of the image of metrology objects.
 set_metrology_model_paramSetMetrologyModelParamSetMetrologyModelParamset_metrology_model_paramSetMetrologyModelParamset_metrology_model_param
 Set parameters that are valid for the entire metrology model.
 set_metrology_object_fuzzy_paramSetMetrologyObjectFuzzyParamSetMetrologyObjectFuzzyParamset_metrology_object_fuzzy_paramSetMetrologyObjectFuzzyParamset_metrology_object_fuzzy_param
 Set fuzzy parameters or fuzzy functions for a metrology model.
 set_metrology_object_paramSetMetrologyObjectParamSetMetrologyObjectParamset_metrology_object_paramSetMetrologyObjectParamset_metrology_object_param
 Set parameters for the metrology objects of a metrology model.
 write_metrology_modelWriteMetrologyModelWriteMetrologyModelwrite_metrology_modelWriteMetrologyModelwrite_metrology_model
 Write a metrology model to a file.