求助:opencv利用stitcher经行图像拼接遇到了问题
利用的是opencv2.49和vs2015
程序如下:
#include <iostream>
#include <fstream>
#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 = "result.jpg";
int main(int argc, char* argv[])
{
Mat img1 = imread("A:\\Users\\chen\\Desktop\\1.jpg");
Mat img2 = imread("A:\\Users\\chen\\Desktop\\2.jpg");
Mat img3 = imread("A:\\Users\\chen\\Desktop\\3.jpg");
if (img1.empty() || img2.empty() || img3.empty())
{
cout << "Can't read image" << endl;
return -1;
}
imgs.push_back(img1);
imgs.push_back(img2);
imgs.push_back(img3);
Mat pano;
Stitcher stitcher = Stitcher::createDefault(try_use_gpu);
Stitcher::Status status = stitcher.stitch(imgs, pano);
if (status != Stitcher::OK)
{
cout << "Can't stitch images, error code = " << int(status) << endl;
return -1;
}
imwrite(result_name, pano);
Mat pano2 = pano.clone();
imshow("全景图像", pano);
if(waitKey()==27)
return 0;
}
运行完后关闭窗口就出现了如下所示的问题,请问是什么原因,怎么解决呢??
问题为:
Microsoft Visual C++ Runtime Library
Debug Assertion Failed!
programe:H\visual studio 工程\opencv2.49\Debug\opencv2.49.exe
File:minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line:892
Expression:is_block_type_vaild(header->_block_use)
For information on how your program can cause an assertion
failure,see the visual c++ documentation on asserts.
(Press Retry to debug the application)
刚接触opencv不久希望大神能帮忙解决一下问题。