-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_panorama.cpp
52 lines (36 loc) · 1.33 KB
/
build_panorama.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/stitching/stitcher.hpp>
#ifdef _DEBUG
#pragma comment(lib, "opencv_core246d.lib")
#pragma comment(lib, "opencv_imgproc246d.lib") //MAT processing
#pragma comment(lib, "opencv_highgui246d.lib")
#pragma comment(lib, "opencv_stitching246d.lib");
#else
#pragma comment(lib, "opencv_core246.lib")
#pragma comment(lib, "opencv_imgproc246.lib")
#pragma comment(lib, "opencv_highgui246.lib")
#pragma comment(lib, "opencv_stitching246.lib");
#endif
using namespace cv;
using namespace std;
int main()
{
vector< Mat > vImg;
Mat rImg;
// vImg.push_back( imread("./workspace/r30.jpg") );
vImg.push_back( imread("./workspace/r45.jpg") );
vImg.push_back( imread("./workspace/r90.jpg") );
vImg.push_back( imread("./workspace/r135.jpg") );
//vImg.push_back( imread("./workspace/r150.jpg") );
Stitcher stitcher = Stitcher::createDefault();
unsigned long AAtime=0, BBtime=0; //check processing time
AAtime = getTickCount(); //check processing time
Stitcher::Status status = stitcher.stitch(vImg, rImg);
BBtime = getTickCount(); //check processing time
printf("%.2lf sec \n", (BBtime - AAtime)/getTickFrequency() ); //check processing time
if (Stitcher::OK == status)
imwrite("workspace/result.jpg",rImg);
else
printf("Stitching fail.");
}