Shape-based matching with MVTec HALCON: Introductory tutorial


Hello and welcome. In machine visions applications,
matching can be used to count objects, get their position and orientation, and more. In this video, we want to take a first look
at shape-based matching with MVTec HALCON. If you already know the basics, have a look
at the advanced tutorial. Right now, our example program only displays
a series of images. Our goal is to find all circlips that are
identical to this one. First, we need to teach HALCON what to look
for. For this, we need an image that shows only
one circlip. Using this dialog in the Graphics Window,
we can quickly create a region of interest, or ROI. Then, we insert the code �
the operator gen_rectangle1 is added. Next, we need to reduce the domain of the
image so that only this part of the image is processed. To learn more about images, regions,
and domains, check out our tutorial on variables. To finish the preparation, we add the operator
create_shape_model. It creates the model that will be used for
matching. Now, we can step into the loop that reads
and displays all images. We add the operator find_shape_model. In the Variable Window, we can see that a
match is found. Its coordinates, angle and score are displayed. To visualize the result in the image,
you can use the procedure dev_display_shape_matching_results. When skipping through the images,
we can see that the matching works pretty well,
despite some of the images being very overexposed, or underexposed. That’s because shape-based matching is based
on contours, not on gray values,
and is therefore very robust against illumination changes. In this image, the circlip is oriented very
differently. You may have noticed that both create_shape_model
and find_shape_model have the parameters AngleStart and AngleExtent. These parameters allow you to limit the orientations
in which the object can be found. A smaller range improves the performance. We extend both operators
such that the object can be found in every rotation. If you expect multiple instances
of the same object in your images, you can raise NumMatches. Or alternatively, if you set it to zero,
all relevant matches are returned. With these settings,
we get good matching results in some very cluttered images. All circlips that have the same shape and
size are found correctly. Lastly, you should add the operator clear_shape_model
at the end of your program to free the memory used by the shape model. This concludes our video. You can download the finished program
and the program shown in the beginning to try it out for yourself. Take a look at the other matching tutorials
to learn about more advanced parameters of shape-based matching,
and how to process the results of your matching. Thank you for watching.

2 Replies to “Shape-based matching with MVTec HALCON: Introductory tutorial”

Leave a Reply

Your email address will not be published. Required fields are marked *