find_deformable_surface_model — Find the best match of a deformable surface model in a 3D scene.
find_deformable_surface_model finds the best match of
the deformable surface model
DeformableSurfaceModel in the 3D scene
The deformable surface model must have been
created previously with, for example,
The matching requires that the 3D object model
contains points and normals.
The scene shall provide one of the following options:
points and point normals
points and a 2D-Mapping, e.g. an XYZ image triple converted with
It is important for an accurate pose that the normals of the scene
and the model point in the same direction (see
Note that triangles or polygons in the passed scene are ignored.
Instead, only the vertices are used for matching.
It is thus in general not recommended to use this operator on meshed scenes,
such as CAD data.
Instead, such a scene must be sampled beforehand using
sample_object_model_3d to create points and normals.
When using noisy point clouds, e.g., from time-of-flight cameras, the
generic parameter 'scene_normal_computation' should be set to
'mls' in order to obtain more robust results (see below).
First, points are sampled uniformly from the scene passed in
ObjectModel3D. The sampling distance is controlled with
RelSamplingDistance, and is given relative
to the diameter of the surface model.
RelSamplingDistance leads to more sampled points,
and in turn to a more stable but slower matching. Increasing
RelSamplingDistance reduces the number of sampled scene
points, which leads to a less stable but faster matching. For an
illustration showing different values for
please refer to the operator
get_deformable_surface_matching_result can be used to
retrieve the sampled scene points for visual inspection.
For a robust matching it is recommended that at least 50-100
scene points are sampled for each object instance.
The method first finds an approximate position of the object. This position is then refined. The generic parameters controlling the deformation are described further down.
If a match was found, the score of the match is returned in
and a deformable surface matching result handle is
Details of the matching result, such as the deformed model and the position
of the reference points, can be queried with the operator
get_deformable_surface_matching_result using the result handle.
The score is normalized between 0 and 1 and represents
the amount of model surface visible in the scene. A value of
1 represents a perfect match.
MinScore can be used to filter the result.
A match is returned only if its score exceeds the value of
GenParamValue are used
to set generic parameters. Both get a tuple of equal length, where the
tuple passed to
GenParamName contains the names of the
parameters to set, and the tuple passed to
the corresponding values. The possible parameter names and values
are described below.
This parameter controls the normal computation of the sampled
In the default mode 'fast', normals are computed based on
a small neighborhood of points.
In the mode 'mls', normals are computed based on a larger
neighborhood and using the more complex but more accurate
A more detailed description of the 'mls' method can be
found in the description of the operator
The 'mls' mode is intended for noisy data, such as images
from time-of-flight cameras.
Value list: 'fast', 'mls'
Default value: 'fast'
Invert the orientation of the surface normals of the scene. The orientation of surface normals of the scene have to match with the orientation of the model. If both the model and the scene are acquired with the same setup, the normals will already point in the same direction. If you experience the effect that the model is found on the 'outside' of the scene surface, try to set this parameter to 'true'. Also, make sure that the normals in the scene all point either outward or inward, i.e., are oriented consistently.
Possible values: 'false', 'true'
Default value: 'false'
Number of iterations for the refinement. Increasing the number of iteration leads to a more accurate position at the expense of runtime. However, once convergence is reached, the accuracy can no longer be increased, even if the number of steps is increased.
Suggested values: 1, 10, 25, 50
Default value: 25
Assertion: 'pose_ref_num_steps' > 0
Set the distance threshold for refinement relative to the diameter of the surface model. Only scene points that are closer to the object than this distance are used for the optimization. Scene points further away are ignored.
Suggested values: 0.05, 0.1, 0.25, 0.3
Default value: 0.25
Assertion: 0 < 'pose_ref_dist_threshold_rel'
Set the distance threshold for dense pose refinement as absolute value. See 'pose_ref_dist_threshold_rel' for a detailed description. Only one of the parameters 'pose_ref_dist_threshold_rel' and 'pose_ref_dist_threshold_abs' can be set. If both are set, only the value of the last parameter is used.
Assertion: 0 < 'pose_ref_dist_threshold_abs'
Set the distance threshold for scoring relative to the diameter of the surface model. See the following 'pose_ref_scoring_dist_abs' for a detailed description. Only one of the parameters 'pose_ref_scoring_dist_rel' and 'pose_ref_scoring_dist_abs' can be set. If both are set, only the value of the last parameter is used.
Suggested values: 0.1, 0.05, 0.03, 0.005
Default value: 0.03
Assertion: 0 < 'pose_ref_scoring_dist_rel'
Set the distance threshold for scoring. Only scene points that are closer to the object than this distance are considered to be 'on the model' when computing the score after the refinement. All other scene points are considered not to be on the model. The value should correspond to the amount of noise on the coordinates of the scene points. Only one of the parameters 'pose_ref_scoring_dist_rel' and 'pose_ref_scoring_dist_abs' can be set. If both are set, only the value of the last parameter is used.
This operator returns a handle. Note that the state of an instance of this handle type may be changed by specific operators even though the handle is used as an input parameter by those operators.
This operator supports cancelling timeouts and interrupts.
Handle of the deformable surface model.
Handle of the 3D object model containing the scene.
Scene sampling distance relative to the diameter of the surface model.
Default value: 0.05
Suggested values: 0.1, 0.07, 0.05, 0.04, 0.03
0 < RelSamplingDistance < 1
→(real / integer)
Minimum score of the returned match.
Default value: 0
MinScore >= 0
Names of the generic parameters.
Default value: 
List of values: 'pose_ref_dist_threshold_abs', 'pose_ref_dist_threshold_rel', 'pose_ref_num_steps', 'pose_ref_scoring_dist_abs', 'pose_ref_scoring_dist_rel', 'scene_invert_normals', 'scene_normal_computation'
→(string / real / integer)
Values of the generic parameters.
Default value: 
Suggested values: 'fast', 'mls', 0, 1, 10, 25, 50, 0.05, 0.1, 0.25, 0.3, 0.05, 0.03, 0.005
Score of the found instances of the surface model.
Handle of the matching result.
find_deformable_surface_model returns 2 (H_MSG_TRUE) if all parameters are
correct. If necessary, an exception is raised.