如何在openCV中的matchTemplate()中处理边界像素?

时间:2013-11-24 08:39:33

标签: opencv

我试图在两个图像之间进行相关(较小的图像和较大的图像)。如何在openCv中完成边界处理?

cv::matchTemplate(webcamImageReceived,templateImage,resultImage,CV_TM_CCORR_NORMED);

1 个答案:

答案 0 :(得分:2)

模板永远不会跨越图像边界,结果图像的大小会因模板大小而减小(每个图像侧的模板大小为一半)。

请看这里:http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html

(看看:

  /// Create the result matrix
  int result_cols =  img.cols - templ.cols + 1;
  int result_rows = img.rows - templ.rows + 1;

相关问题