当前位置: 首页 > news >正文

opencv中stitch图像融合

 openv版本: opencv249 

 vs :2010

 qt : 4.85

#include "quanjing.h"

#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/stitching/stitcher.hpp>
using namespace std;
using namespace cv;
bool try_use_gpu = false;
vector<Mat> imgs;
string result_name = "dst1.jpg";
#include <QApplication>
#include  <QMessageBox>
using namespace cv;


quanjing::quanjing(QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags)

{
	ui.setupUi(this);

	connect(ui.pushButton,SIGNAL(clicked()),this,SLOT(btnClick()));	
}


void quanjing::btnClick(){

	cv::Mat image2 = cv::imread("C:/Users/TR/Desktop/quan/2.jpg");
	cv::Mat image3 = cv::imread("C:/Users/TR/Desktop/quan/3.jpg");
	cv::Mat image4 = cv::imread("C:/Users/TR/Desktop/quan/4.jpg");
	cv::Mat image5 = cv::imread("C:/Users/TR/Desktop/quan/5.jpg");

	imgs.push_back(image2);
	imgs.push_back(image3);
	imgs.push_back(image4);
	imgs.push_back(image5);

	Stitcher   stitcher = Stitcher::createDefault(true);
	// 使用stitch函数进行拼接
	Mat pano;
	Stitcher::Status status = stitcher.stitch(imgs, pano);
	
	if (status != Stitcher::OK)
	{
		cout << "Can't stitch images, error code = " << int(status) << endl;
		 QMessageBox::warning(nullptr, "jing gao", QString("Can't stitch images, error code : %1").arg( int(status) ));
	}
	else
	{
		imwrite("D:/Test/QT/qt04/quanjing/quanjing/555.jpg", pano);
		Mat pano2 = pano.clone();
		// 显示源图像,和结果图像
		imshow("全景图像1", pano2);

	}
}

quanjing::~quanjing()
{

}

准备了四张图像


2 、3 、4三张 进行stitch,结果如下:


3 、4、5三张进行stitch,结果如下:


2、3、4、5 四张一起进行stitch,结果如下:


经过测试,有时候图像序列中某两个连续的出现stitch,错误图像以后的图像就不会再融合了


感觉  opencv的stitch进行图像融合,不太稳定,有时候说不出来为什么两个图像不能融合,肉眼都可以判断出是可以融合的


FR:徐海涛(hunkxu)

相关文章:

  • 学c++的人可以几天速通python?
  • C语言历史
  • ThreadPoolExecutor 源码分析
  • 荣耀手机卸载应用商店、快应用中心等系统自带的
  • Linux 命令:按内存使用大小排序查看 PID 的完全指南
  • Swift实战(微调多模态模型Qwen2.5 vl 7B)
  • 基于香橙派 KunpengPro学习CANN(3)——pytorch 模型迁移
  • JavaScript基础-获取元素
  • Shell脚本中的弱治简写
  • 平衡树的模拟实现
  • Golang开发
  • ROS合集(一)ROS常见命令及其用途
  • springboot多种生产打包方式教程
  • 循环神经网络中用到的概率论知识
  • YOLOv8 OBB 旋转目标检测模型详解与实践
  • 59. 螺旋矩阵 II
  • 深度洞察:特种设备作业考试的核心要点与备考策略
  • 蓝桥杯 修剪灌木
  • opencv初步学习——图像处理3
  • LeetCode BFS层序遍历树
  • 北京移动网站建设公司排名/国外免费推广网站有哪些
  • 17网一起做网站/黄页88
  • 唯美谷-网站建设/站长检测工具
  • 游戏网页设计论文/杭州seo关键字优化
  • 做学校网站素材/sem是什么职位
  • 微信网站设计分析/seo的中文含义是什么