I\'ve been messing around with the OpenCV bindings for python for a while now and i wanted to try template matching, i get this error and i have no idea why
Pay attention to the error message:
error: (-215) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 in function cv::matchTemplate
It means the data type of the image should be CV_8U or CV_32F, and it should have 3 or less channels.
If you don't know what CV_8U, CV_32F means, see this list.
Probably you are passing numpy objects other than np.uint8 or np.float32. you can easily convert numpy dtype to 8-bit or 32-bit using:
img.astype(np.float32)
img.astype(np.uint8)
Just pay attention that OpenCV expect CV_8U 8-bit data to be in the range 0..255 and CV_32F can be in any range.