Mat src = mat_ori;//imread(img_original);Mat src_template = imread(img_template);cvtColor(src, src, COLOR_BGR2RGB);//不转换,matchTemplate将报错cvtColor(src_template, src_template,COLOR_BGR2RGB);//不转换,matchTemplate将报错
error: (-215:Assertion failed) (depth == CV_8U || depth == CV_32F) && type == _templ.type() && _img.dims() <= 2 in function 'cv::matchTemplate
解决方法:
Mat src = mat_ori;//imread(img_original);
Mat src_template = imread(img_template);
cvtColor(src, src, COLOR_BGR2RGB);//不转换,matchTemplate将报错
cvtColor(src_template, src_template,COLOR_BGR2RGB);//不转换,matchTemplate将报错