Ask Your Question

Revision history [back]

matchTemplate with multi-rectangular template

I have shapes that tend to be composites of rectangles what I need to detect position. Here is an example of one such shape. image description

Lighting is very consistent between reference object and image being searched.

I can't use matchTemplate with a rectangular template because the nozzle holding the part can be at different locations. The nozzle sometimes cover the pins, othertimes not. The black nozzle is highlighted by red markings. image description

My thought is to do multiple matchTemplates and shift their results so their xy represent same coordinates of the original object. The following gives and example of the multiple templates.

image description

In this solution, the user would select the multiple rectangles. Before I reinvent the wheel, is there such an implementation available. Is there a better solution?

Regards, John