#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;
這里面,為什么呢??
uj5u.com熱心網友回復:
影像是否加載成功?https://blog.csdn.net/dcrmg/article/details/52653366
uj5u.com熱心網友回復:
圖片加載成功的,單獨imshow讀入的圖片,顯示是正常的
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/172591.html
標籤:圖形處理/算法
上一篇:OpenCV的兼容問題
