拼接stitcher出的结果为空???

milkqaq 2020-10-14 11:16:18
#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";
int main(int argc, char * argv[])
{
cout << CV_VERSION<<endl;
double t = (double)getTickCount();
Mat img1 = imread("11.bmp");
Mat img2 = imread("22.bmp");

imshow("p1", img1);
imshow("p2", img2);

imgs.push_back(img1);
imgs.push_back(img2);

Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
// 使用stitch函数进行拼接
Mat pano;
Stitcher::Status status = stitcher.stitch(imgs, pano);
if (pano.empty())
cout << "kong" << endl;


Mat pano2 = pano.clone();
//显示源图像,和结果图像

if (!pano2.empty()) {
imshow("game", pano2);
}


t = ((double)getTickCount() - t) / getTickFrequency();
cout << "time:" << t << endl;
waitKey(0);
return 0;
}


每次都进入
if (pano.empty())
cout << "kong" << endl;
这里面,为什么呢??
...全文
1232 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
不响丸ne 2021-12-20
  • 打赏
  • 举报
回复

您好,请问解决了吗,怎么解决的呀

kinkon007 2020-10-20
  • 打赏
  • 举报
回复
两张图片重叠的区域不够
  • 举报
回复
@kinkon007 相同区域不够就回返回None吧
milkqaq 2020-10-14
  • 打赏
  • 举报
回复
引用 1 楼 zgl7903 的回复:
图像是否加载成功?
https://blog.csdn.net/dcrmg/article/details/52653366

图片加载成功的,单独imshow读入的图片,显示是正常的
zgl7903 2020-10-14
  • 打赏
  • 举报
回复

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧