-
Notifications
You must be signed in to change notification settings - Fork 45
/
example.cpp
31 lines (25 loc) · 930 Bytes
/
example.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "fftm.hpp"
using namespace std;
using namespace cv;
//-----------------------------------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------------------------------
int main(int argc, unsigned int** argv)
{
Mat im0 = imread("cat.png", 1);
Mat im1 = imread("cat_part.png", 1);
imshow("im1", im1);
imshow("im0", im0);
// As input we need equal sized images, with the same aspect ratio,
// scale difference should not exceed 1.8 times.
RotatedRect rr = LogPolarFFTTemplateMatch(im0, im1,200,100);
// Plot rotated rectangle, to check result correctness
Point2f rect_points[4];
rr.points(rect_points);
for (int j = 0; j < 4; j++)
{
line(im0, rect_points[j], rect_points[(j + 1) % 4], Scalar(255, 0, 0), 2, LINE_AA);
}
imshow("result", im0);
waitKey();
}