I want to compare a specific pattern (as on template image) and output "yes"/"no" according to the match. I don't require the method to be scale invariant. It just has to be translation invariant and rotation invariant (only till +/-2 degrees maximum).
Also, even if there's a slight mismatch between the template image and runtime image, the output should be "no".
So far, here are a couple of codes I have tried:
- Template Matching by Alaa Eleyan: This detects even if the pattern has noise, which I don't want.
- Simple template match. in matlab: This outputs a score of the match. The variation of scores of images with and without noise didn't seem to vary much.
- Fast/Robust Template Matching by Dirk-Jan Kroon: This too detects the pattern even if it's noisy.
- Template Matching using Correlation Coefficients by Yue Wu: It is similar to #3 but takes more time.
Many of them are not invariant to rotation. So at present, I match SURF features and calculate how much the runtime image has been rotated wrt template pattern. I then rotate it in the opposite direction so I need not apply an algorithm which is invariant to rotation (this is why I don't need rotation invariance).
In many cases even if there's no pattern present, it's still falsely detected. Here is a screenshot of output using #3:
Here is another such wrong output:
I have also worked on a couple of Algorithms based on SIFT/ASIFT Features earlier. They are very robust and obviously match patterns even if it's noisy. Hence, I am not using these in the present application.
I have attached an example Template image, and Yes and No images for your reference.
Please let me know an algorithm for this purpose. I thought it was a simple template match, but in many cases, it was falsely detected.
At present I think I can use #3 algorithm to at least detect the position of pattern in runtime image (as shown in 2nd screenshot above) and match this region. Is this possible? I can't use image subtraction because it's not exactly a pixel-to-pixel match. There may be very slight variations.
Any inputs will be appreciated.
Regards,
Meghana.