-
Notifications
You must be signed in to change notification settings - Fork 47
/
lab03.cpp
45 lines (37 loc) · 1 KB
/
lab03.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
#include <iostream>
#include<opencv2\opencv.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/stitching.hpp>
using namespace std;
using namespace cv;
bool try_use_gpu = false;//是否使用GPU,否
vector<Mat> imgs;
vector<Mat> imgss;
int jiequ_shang = 30;//截取高度上
int jiequ_xia = 60;//截取高度下
int main(int argc, char * argv[])
{
Mat img1 = imread("pinjie1.jpg");
Mat img2 = imread("pinjie2.jpg");
Mat img3 = imread("pinjie3.jpg");
imshow("p1", img1);
imshow("p2", img2);
imshow("p3", img3);
imgs.push_back(img1);
imgs.push_back(img2);
Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
Mat tmp;
stitcher.stitch(imgs, tmp);
imgss.push_back(tmp);
imgss.push_back(img3);
Mat dst;
stitcher.stitch(imgss, dst);
imshow("结果", dst);
Rect rect(0, jiequ_shang, dst.cols, dst.rows-jiequ_xia);
Mat image_roi = dst(rect);
imshow("截取后", image_roi);
waitKey(0);
return 0;
}