関数を探していると思いますcv::matchTemplate
:
cv::Mat image; // Your input image
cv::Mat templ; // Your template image of the screw
cv::Mat result; // Result correlation will be placed here
// Do template matching across whole image
cv::matchTemplate(image, templ, result, CV_TM_CCORR_NORMED);
// Find a best match:
double minVal, maxVal;
cv::Point minLoc, maxLoc;
cv::minMaxLoc(result, &minVal, &maxVal, &minLoc, &maxLoc);
// Regards to documentation the best match is in maxima location
// (http://opencv.willowgarage.com/documentation/cpp/object_detection.html)
// Move center of detected screw to the correct position:
cv::Point screwCenter = maxLoc + cv::Point(templ.cols/2, templ.rows/2);