| Developers' Corner

Improve your surface-based matching with two helpful features

Do you sometimes have objects, which have rather small symmetry-breaking elements (such as small boreholes on an object)? Does your surface-based 3D matching not find the correct orientation?

No worries! Since HALCON 20.05 we introduced the parameter 'train_self_similar_poses', which prepares the surface model for optimizations regarding self-similar, almost symmetric poses.

Let's have a look at the outstanding performance:

Without this parameter all the objects are found, but the orientations are not always correct. With the parameter on, all the orientations are corrected.

The usage is very simple, set the parameter 'train_self_similar_poses' to 'true 'in create_surface_model() and use it in find_surface_model() with 'use_self_similar_poses'. If you are not satisfied with automatically calculated similar poses, you can also set your own similar poses with set_surface_model_param (SurfaceModelID, 'self_similar_poses', SelfSimilarPoses). There are also other operators which support this feature like refine_surface_model_pose(), refine_surface_model_pose_image(), find_surface_model_image().

Explore the parameter with our standard example find_surface_model_self_similar_poses.hdev!


Only a small part of the 3D object model is visible while using surface-based matching, which results in low scores and makes it difficult to set MinScore.

With HALCON 19.11, we introduced the parameter 'train_view_based', which enables the training for view-based score computation with surface-based matching and refinement. The view-based score is computed using the ratio of the matched points to the maximum number of potentially visible model points from a certain viewpoint instead of the ratio to the total number of points.

Without view-based score activated, the matching scores are low because the invisible model points are also used for computing the final matching score. With the view-based score on, the scores are higher and more meaningful. In order to use the view-based score computation, the surface-based model should be created with 'train_view_based' set to 'true', and 'use_view_based' should be set to 'true' in find_surface_model(). Default is 'false' if 'train_view_based' was disabled when creating the model, otherwise 'true'.

Explore this parameter with the standard example find_surface_model_view_based_score.hdev!


MVTec experts regularly contribute tips and tricks for solving different vision tasks with MVTec HALCON and MERLIC. Check out the developer's corner at the MVTec website and feel free to ask questions or suggest an interesting topic yourself.