資源簡介
帶旋轉的模板匹配的原理及算法實現(c++).zip
代碼片段和文件信息
#include
#include
//#include
#include
using?namespace?cv;
using?namespace?std;
//ROI區域的位置信息
#define?xx?100//300//??//橫坐標
#define?yy?100//80//240//???//縱坐標
#define?zz?300//400//??//正方形ROI區域的邊長
#define?PI?3.14159267989
#define?ModelPATH?“..\\ConsoleApplication1\\picture\\my?Logo.bmp“//模板圖像路徑
#define?SearchPATH?“..\\ConsoleApplication1\\picture\\my?Logo.bmp“//待檢測圖像路徑
int?nThresh?=?80;//二值化處理的控制閾值,最大值為255
//圖片旋轉函數
void?imrotate(Mat?&img?Mat?&newIm?double?angle)//img:輸入圖片;newIm:輸出圖片;angle:旋轉角度(°)
{
//int?len?=?max((img.cols)?(img.rows));
//Point2f?pt(len?/?2.0?len?/?2.0);
//Mat?r?=?getRotationMatrix2D(pt?angle?1.0);
//warpAffine(img?newIm?r?Size(len?len));
//better?performance?:
Point2f?pt(img.cols?/?2.?img.rows?/?2.);
Mat?r?=?getRotationMatrix2D(pt?angle?1.0);
warpAffine(img?newIm?r?img.size());
}
//取圓形ROI區域函數:具體實現功能為輸入原圖,取原圖最大可能的原型區域輸出
Mat?circle_tr(Mat?src)
{
Mat?dst?=?Mat::
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????8420??2018-09-10?00:19??Match.cpp
評論
共有 條評論