Ask Your Question

Revision history [back]

According to the doc, the only important thing is that your images are in 8 bits or 32 bits, and template and image must be in the same format. So you could use a grayscale template with a color image (until both or them are 8/32 bits) or the opposite. You could also, which is more "logical" used a grayscale template with a grayscale image, and a color template with a color image.

From what I understand from the code of crossCorr function (used by matchTemplate) is that the computation is made channel by channel, and the results are summed. You could compute template matching with each channel of a color source image and manually add results to compare.

By the way, single channel means one channel...;-) which is usually associated to grayscale, but could be something different, like a distance map (with 32 or 64 bits depth). This is not really grayscale, and could be represented in grayscale as well as in (fake) colors, like for thermal image for example. But most of the time, you could assume that single channel is grayscale.