#define CAPI extern "C" __declspec(dllexport) // C方式导出函数
struct CPoint
{
int x = 0;
int y = 0;
};
double test(Mat& src, Mat& temp,int method, CPoint& p)
{
Mat result;
matchTemplate(src, temp, result, method);
double mxValue, mnValue;
Point mxPoint, mnPoint;
minMaxLoc(result, &mnValue, &mxValue, &mnPoint, &mxPoint);
p.x = mxPoint.x;
p.y = mxPoint.y;
return mxValue;
}
CAPI double predict( char* srcFile, char* tempFile, CPoint& p)
{
Mat src = imread(srcFile);
Mat temp = imread(tempFile);
int method = cv::TemplateMatchModes::TM_CCOEFF_NORMED;
return test(src, temp, method, p);
}