03-05-2022 10:35 AM
I'm currently making a pattern matching program that detects key. But somehow its accuracy in a real time detection is really bad because of the light environment. I'm thinking of putting several templates of different brightness and different background color but I don't know which function should I use.
Solved! Go to Solution.
06-13-2022 10:28 AM
So you are using Geometric Matching, which should be more or less independent from brightness, rotation, scale and partial occlusion.
I would try using "IMAQ Advanced Setup Match Geometric Pattern 2", there are some advanced tuning parameters that make the balance between grayscale correlation (which depends on brightness) and edge geometry detection (which depends on edge quality):
- Enable Contrast Reversal
- Scoring Method
- Enable Correlation score
- Enable Target Template Curve Score
See the help of the VI for parameters explanation.
06-14-2023 03:14 AM
is it possible when pattern matching is used instead of geometric matching for multiple matching?
06-14-2023 04:25 AM - edited 06-14-2023 04:27 AM
Hi,
Depending on the quality of your images, there are several pattern matching algorithms that you can use: Low Discrepancy Sampling, Grayscale Value Pyramid, Gradients Pyramid.
The VIs "IMAQ Learn Pattern" and "IMAQ Match Pattern" also have an input for advanced parameters.
I highly recommend using Vision Assistant first to test your algorithm and parameters. Often, the preset parameters are already very good.
Then you can export to LabVIEW code to integrate it into your application.
Regards,
Raphaël.
08-01-2023 09:29 PM
Thank you @raphschru !
Yes, I tried using the advanced option and it worked. But I am looking for a way of using two different templates and matching those templates to one image.
08-02-2023 03:05 AM
When you have multiple templates, just execute the match function multiple times, each time with a different pattern.
Then you will need to merge your results and filter out matches from different templates that are at similar positions.
For that, you will need a clustering algorithm that can group together points that are close to each other (based on proximity).
Then for each "group", take the match with the highest score.
If you are not familiar with the term clustering: https://en.wikipedia.org/wiki/Cluster_analysis
08-03-2023 01:29 AM
Thanks for this @raphschru.
1. When you have multiple templates, just execute the match function multiple times, each time with a different pattern.
I'm finished with this one.
2. Then you will need to merge your results and filter out matches from different templates that are at similar positions.
I am stuck with this; I am thinking of passing the match info (Bounding box x &y or Position) to Excel and doing the formula in there. But I am also thinking if there is another way other than using a third-party app.
3. Then for each "group", take the match with the highest score.
Yes, I will select the one with the highest score match after I did step 2.