|
@@ -36,7 +36,9 @@ int main()
|
|
|
else
|
|
|
{
|
|
|
// TODO: 在此处为应用程序的行为编写代码。
|
|
|
+#ifdef _DEBUG
|
|
|
test();
|
|
|
+#endif
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -431,7 +433,7 @@ CV_API bool MatchSingleImage(cv::Mat& img, cv::Mat templImg, double& matchVal, c
|
|
|
1 表示完全相同,-1 表示两幅图像的亮度正好相反,0 表示两幅图像之间没有线性关系。
|
|
|
*/
|
|
|
cv::Mat resultImg;
|
|
|
- cv::matchTemplate(img, templ, resultImg, cv::TM_CCOEFF_NORMED);
|
|
|
+ cv::matchTemplate(img, templImg, resultImg, cv::TM_CCOEFF_NORMED);
|
|
|
if (resultImg.empty())
|
|
|
return false;
|
|
|
|
|
@@ -448,8 +450,8 @@ CV_API bool MatchSingleImage(cv::Mat& img, cv::Mat templImg, double& matchVal, c
|
|
|
// 匹配区域,使用最大区域;
|
|
|
matchRect.x = lv_nMaxLoc.x;
|
|
|
matchRect.y = lv_nMaxLoc.y;
|
|
|
- matchRect.width = templ.cols;
|
|
|
- matchRect.height = templ.rows;
|
|
|
+ matchRect.width = templImg.cols;
|
|
|
+ matchRect.height = templImg.rows;
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
// 在原图上框出模板位置;
|
|
@@ -457,7 +459,7 @@ CV_API bool MatchSingleImage(cv::Mat& img, cv::Mat templImg, double& matchVal, c
|
|
|
img.copyTo(showImg);
|
|
|
cv::rectangle(showImg,
|
|
|
cv::Point(lv_nMaxLoc.x, lv_nMaxLoc.y),
|
|
|
- cv::Point(lv_nMaxLoc.x + templ.cols, lv_nMaxLoc.y + templ.rows),
|
|
|
+ cv::Point(lv_nMaxLoc.x + templImg.cols, lv_nMaxLoc.y + templImg.rows),
|
|
|
cv::Scalar(rand() % 255, rand() % 255, rand() % 255),
|
|
|
2,
|
|
|
cv::LINE_AA,
|
|
@@ -563,3 +565,13 @@ CV_API bool MatchSingleImage(std::string strImg, std::string strTmpImg, double&
|
|
|
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+CV_API bool Mat2Bitmap(cv::Mat& img, CBitmap& bitmap)
|
|
|
+{
|
|
|
+ return CV_API bool();
|
|
|
+}
|
|
|
+
|
|
|
+CV_API bool Mat2GdiplusBitmap(cv::Mat& img, Gdiplus::Bitmap& bitmap)
|
|
|
+{
|
|
|
+ return CV_API bool();
|
|
|
+}
|