I've been working on a shape matching function, using emgu, for detecting objects given a template of the object and a target image in which to find it. The target image can contain multiple instances of the template.
The function I built works reasonably well. I have one concern. If my template has more than one hole, the function will probably not give a correct answer.
Here is the most important part of the code: