Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Assuming both image1 and image2 are the same size:

float correlation(cv::Mat &image1, cv::Mat &image2) 
{
    cv::Mat corr;
    cv::matchTemplate(image1, image2, corr, cv::TM_CCORR_NORMED);
    return corr.at<float>(0,0);  // corr only has one pixel
}