Pattern Recognition with Geometric Model Finder
Welcome back to ClearView Blog. In our last blog we explored the Pattern Matching tool from Matrox as well as the normalised greyscale correlation (NGC) algorithm it utilises.
We’ll now be turning our attention to Geometric Model Finder (GMF) as a way to recognise patterns using machine vision. This form of pattern recognition offers a different approach to pattern recognition tasks than NGC, and understanding how it works will help you when choosing an algorithm for your vision application.
Introduction to Geometric-Based Pattern Recognition
As we outlined at the start of this series, GMF tends to be more robust than NGC Pattern Matching. Let’s take a look at why the geometric approach tends to provide reliable results where NGC cannot.
What does Geometric Model Finder do?
GMF can locate objects in a variety of different circumstances. It employs an edge-based algorithm, rather than looking at pixel values, to find a pre-defined model within a target image. It can find a single model on its own, or multiple models simultaneously, and then return the position, angle, and scale of each occurrence of each model found in the target image.
GMF looks for different types of models that can be created in three different ways:
- Image-type models;
- Predefined shapes;
- External sources.
GMF with Image-Type Models
For image-type models, GMF can extract the edges from a model source image and convert this information into a geometric model for future matching. There is no limit here; you can define as many models as you need.
GMF with Predefined Shape Models
For predefined shape models, GMF provides several basic shapes to get started with.
Depending on your application, using a pre-defined shape may be faster and easier than defining a model from an image.
Feature extraction with predefined shapes applied to model source image
GMF with External Models
For external models, GMF can create a model from the results from other processing tools from Matrox, such as Edge Finder and Model Finder, or from third party software, for instance a DXF file generated from CAD software.
Feature extraction using information from a DXF file to generate a model for GMF
Regardless of the source, a model defined in GMF is a collection of edges. This brings us onto the inherent geometric approach to pattern matching in GMF.
How does Geometric Model Finder Work?
GMF searches for a match based on geometric features.
Above, we have a target image containing a T-shaped object. We want to define this as a model, so that the GMF tool can search for this object in future target images.
Once you have defined this object as the model, GMF extracts edge features of the model based on the settings that you provide.
Next, you need to provide a target image, from which GMF will once again extract edge features, based on the settings you provided before.
Once the target image edges have been extracted, GMF performs a candidate pre-search, which scans the target image, discovering and ranking locations where an occurrence of the model might be found.
These ranked candidates move onto the next stage: candidate match.
In the candidate match, GMF scores the most promising candidates based on a similarity measure, and returns the best match or matches, provided their score is above a minimum threshold.
Why is Geometric Model Finder so Robust?
The Geometric Element
The reason GMF outcompetes NGC in versatility is because this type of matching is based on geometric features. This means than GMF can find models in images that contain occlusions, or variable lighting, which are typical situations where NGC might fall down.
Often, GMF is even robust enough to find different coloured objects. Keep in mind that GMF works with greyscale images, so you would need to perform a colour conversion or use a monochrome camera beforehand.
Degrees of Freedom
GMF can locate objects using multiple degrees of freedom. Promising candidates in the target image can be matched based on their geometric similarities, even if the position, rotation, and size differ from the models.
The tool cannot directly find the models in skewed or perspective images; however, if you provide a calibration file, or first calibrate your camera, models can still be found, even in the presence of distortion. GMF can also handle changes in aspect ratio, given the right settings are provided by the user.
Degrees of freedom with GMF
Considerations of using Geometric Model Finder
GMF, like many image processing tools, is designed for 2D imaging. It finds 2D models in 2D images.
If the real world item that you are using to define your 2D model has a considerable height, like a can of tuna for example, then measures need to be taken to ensure that the 2D representation of that tuna can is as close as possible to the model. How the can of tuna appears in an image will vary greatly depending on the camera angle and item placement.
These different 2D representations create different extracted edges, which will likely lead to poor results when it comes to matching.
Making efforts to ensure the angle and positioning of the can of tuna in relation to the camera at the point of triggering will give a much higher chance of success. 3D objects can appear ‘flatter’ when the focal length and working distance are increased, which will likely mean a higher chance of success whilst running GMF.
Which Imaging Software is Best for Geometric Model Finder?
There are a few different software packages you can use to run the GMF tool, and the intentions of your project will dictate which is best to use.
Model Finding in Matrox Design Assistant (DA) X
If you are looking to create a vision system that will do GMF, and prefer a flowchart-based approach to developing your application, then DA X is the best programme to use.
Model Finder in Matrox Design Assistant X
DA X is simple to use, and contains powerful image processing tools like Model Finder that will perform brilliantly in a wide variety of vision applications.
Model Finding in Matrox Imaging Library (MIL) X
MIL X is an advanced and rugged image processing software development kit, built with flexibility and capability in mind. If you are looking to build and develop a full vision application for pattern recognition and more using C++, C#, Python, or Visual Basic, then MIL X is the best software to do this. Not only does it come with all the features of DA X, but you also gain the ability to design and implement your own GUI.
If you want to go a step further, we recommend getting the most out of MIL X with CoPilot.
Model Finding in MIL CoPilot
MIL CoPilot provides a unified interactive environment to experiment with MIL, allowing programmers to test one or more approaches to solving an application before writing any code. In the context of pattern matching, this means you could create a model, and test it with both the Geometric Model Finder and Pattern Matching tools to see which gives the best results for your application – all without writing a single line of code. This flexible, programming-free environment offers those new to MIL an easier way to try it out.
MIL CoPilot Overview
Need Machine Vision Help? Give us a shout!
Thanks for reading this machine vision blog – but your time with us doesn’t have to end here!
Want to find out more about machine vision algorithms? Could you use a hand with your vision system or with automating industrial processes? Look no further – get in touch with us.
Also, be sure to check out our great range of machine vision cameras and machine vision software over in our products section!
Here at ClearView, we have a broad range of knowledge and machine vision expertise to help you decide on the right solution for your project.
We offer friendly expertise and a huge range of industry-standard quality machine vision components for printing and packaging, robotics, industrial automation, medicine, life sciences, and the automotive industry, just to name a few.
Our experts are happy to help no matter what your question or problem may be. Feel free to get in touch with us and one of our machine vision experts will be ready to help you get going with your project!