opencv中的图像拼接

        图像拼接可以实现任意多张平面图像的拼接,可以很好的完成全景图的构建,在opencv中有Stitcher类来实现,废话不多说直接上代码。

#include<opencv2/opencv.hpp>
#include <opencv2/stitching/stitcher.hpp>
#include<opencv2/stitching/warpers.hpp>
#include"1.h"
#include<boost/filesystem.hpp>


using namespace std;
using namespace cv;
using namespace boost::filesystem;


int main()
{
vector<Mat> images;
for (directory_iterator i(DATA_FOLDER_5), end_iter; i != end_iter; i++)
{
string im_name = i->path().filename().string();
string filename = string(DATA_FOLDER_5) + im_name;
Mat im = imread(filename);
if (!im.empty())
{
images.push_back(im);
}
}
cout << "Read" << images.size() << "images" << endl << "Now making panorama..." << endl;
Mat panorama;
Stitcher stitcher = Stitcher::createDefault();
stitcher.stitch(images, panorama);
namedWindow("panorama", CV_WINDOW_NORMAL);
imshow("panorama", panorama);
while (char(waitKey(1) != 'q'))
{


}
return 0;


}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值