Template Matching - Implementation

Is the below still the case…Was wondering if the template matching can handle rotation or scale changes at all? (Was it improved to use a rolling integral image window?)

Template matching using something called an “integral image” to work.
Template matching works by having the camera look a like 32x32 image to find out of
a larger image (e.g. 320x240). That said, template matching doesn’t handle rotation
or scale changes at all. It just slides around the image you want to find on the
large image and then returns the point of best match. This means its very fragile.
This requires 4 bytes per pixel in the big image. So, 307200 bytes… plus the size
of the image itself which is 320x240x2 = 153600 bytes.
So, that’s 460800 in total. The M7 has about 350KB to play with.
We can improve template matching in the future using a rolling integral image window
which will fix this problem.
However, doing template matching in general requires a lot of CPU.

Thanks in Advance!

Hi, template matching hasn’t been worked on in a while. It could use a lot of improvements. The code isn’t a lot and we have a performance optimizer on staff right now.

I’m doing OpenMV IDE updates currently… but, if you place a feature request to improve template matching on the forums we can optimize this method next.

Rotation and scale matching is really CPU intensive right now however. That said, using the log polar transforms might help optimize things.

(Rotation and scale require checking the whole image again at a different scale. Rotation the same way. With log polar it’s possible to remap the image so that rotation matching is cheap).

Where does one make a feature request?

Regards

This helps us track stuff. That said, it can literally sit there forever unless you bug me to do it repeatedly. I’m basically a fire fighter. No squeaking, no oil :wink:

1 Like

I opened up issue 744. Improve Template Matching · Issue #744 · openmv/openmv · GitHub

Thanks in advance!

Super. That said, I can’t say when I will get to it.