opencv之模板匹配后归一化的大坑
直接上代码
#include<opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main(){
///单模板匹配
//Mat temp = imread("D://jy7188//cppProject//image//23//huge_eye.png"); //模板图像
Mat temp = imread("D://jy7188//cppProject//image//23//temp.png"); //模板图像
Mat src = imread("D://jy7188//cppProject//image//23//huge.png"); //待搜索图像
imshow("temp", temp);
imshow("src", src);
Mat dst = src.clone(); //原图备份
int width = src.cols - temp.cols +1; //result 宽度
int height = src.rows - temp.rows +1; //result 高度
Mat result(height, width, CV_32FC1); //创建结果映射图像
matchTemplate(src, temp, result, TM_CCOEFF_NORMED); //化相关系数匹配最佳值为1
imshow("result", result);
for (int row = 0; row < result.rows; row++)
{
for (int col = 0; col < result.cols; col++)
{
result.at<fl