OPENCV 图像拼接 stitching的使用
来源:互联网 发布:.club域名价值 编辑:程序博客网 时间:2024/05/19 17:56
图像拼接技术,现在有非常广泛的应用,如小型机器人的单目视觉的视野较为小,使机器人在应用时有一定的局限性,双目视觉能提供更广阔的视野,双目视觉中较为常用的是对左右两个摄像头获取的识图通过拼接来获取更广阔的视野,再如较为热门的VR,Youtube也极大地运用图像拼接的技术。
图像拼接主要分为几个主要的步骤:
(1)图像的校正:由于成象器件拍摄姿态和扫描非线性会引起的图象几何失真,由于成像系统本身的原因会产生图像的畸变,通过图像的几何校正,图像的畸变校正,使获取的图像更大的接近真实的图像;
(2)图像的滤波:均值滤波,中值滤波;
(3)图像的配准:即图像的对齐,寻找图像边缘重合的部分,常用的图像匹配方法有Harris算法,SIFT算法等;
(4)建立变换模型:根据模板或者图像特征之间的对应关系,计算出数学模型中的各参数值,从而建立两幅图像的数学变换模型
(5)坐标变换:根据建立的数学转换模型,将待拼接图像转换到参考图像的坐标系中,完成统一坐标变换。
(6)图像的融合:将待拼接图像的重合区域进行融合得到拼接重构的平滑无缝全景图像。
先介绍一下opencv中自带的图像拼接例子stitching:
#include <iostream>#include <fstream>#include "opencv2/highgui/highgui.hpp"#include <opencv2\stitching\stitcher.hpp>using namespace std;using namespace cv;int main(void){ string srcFile[3] = { "1.jpg", "2.jpg", "3.jpg" }; string dstFile = "result.jpg"; vector<Mat> imgs; for (int i = 0; i<3; ++i) { Mat img = imread(srcFile[i]); if (img.empty()) { cout << "Can't read image '" << srcFile[i] << "'\n"; system("pause"); return -1; } imgs.push_back(img); } cout << "Please wait..." << endl; Mat pano; Stitcher stitcher = Stitcher::createDefault(false); Stitcher::Status status = stitcher.stitch(imgs, pano); if (status != Stitcher::OK) { cout << "Can't stitch images, error code=" << int(status) << endl; system("pause"); return -1; } imwrite(dstFile, pano); namedWindow("Result"); imshow("Result", pano); waitKey(0); destroyWindow("Result"); system("pause"); return 0;}
先for循环读入图片,并往vector后加入一个数据;
Stitcher Stitcher::createDefault(bool try_use_gpu=false)
再用createDefault创建图像拼接的默认参数;
Status Stitcher::stitch(InputArray images, OutputArray pano)
Stitcher::stitch给出给出合成的图片;
下面是笔者合成图片的效果:
图像有点畸变(可能是拍摄时的问题),不过拼接拼接效果还是很不错的
opencv提供的API手册中对stitcher介绍较少,
接下来尝试自己用代码实现一下
0 0
- OPENCV 图像拼接 stitching的使用
- 【opencv】stitching图像拼接
- OPenCV 图像拼接之------stitching和stitching_detailed
- imge stitching图像拼接stitching
- imge stitching图像拼接stitching
- 图像拼接(十):OPenCV stitching和stitching_detailed
- OpenCV学习笔记(五十一)——imge stitching图像拼接stitching
- 图像拼接(Image Stitching)问题的研究史
- [计算机视觉] 图像拼接 Image Stitching
- 基于OpenCV的图像拼接
- OpenCV学习笔记(五十一)——imge stitching图像拼接stitching OpenCV学习笔记(五十二)——号外:OpenCV 2.4.1 又出来了。。。。。 OpenCV学习笔记(五
- OpenCV2学习笔记(十六):Stitching图像拼接
- stitching.cpp鱼眼图像拼接融合 源码分析
- AutoStitch一种新的高维图像自动拼接方法AutoStitch: a new dimension in automatic image stitching
- OpenCv实现两幅图像的拼接
- opencv实现图像的拼接功能
- 利用OpenCV实现图像拼接的代码!
- opencv多幅图像的拼接算法
- poj2159
- 分布式微服务要点
- 51单片机 指纹模块 MicroSD卡使用和SPI协议的使用5(3)
- FPGA高速采集设计方案
- [编程题]字符串交错组成
- OPENCV 图像拼接 stitching的使用
- PUT or POST in RESTful API design
- centos7 LAMP 加装 phpmyadmin (mariadb)
- GarsiaWachs算法:石子归并问题
- awk+system+getline
- Basic Data Structurek(模拟,双向队列)
- C++复习
- 秋天SWF生成PDF免费版V1.4
- hdu 5929 Basic Data Structure 双端队列