我正在尝试在此站点上调试拼接图像的示例。
这是我的完整代码。
#include < stdio.h >
#include < opencv2\opencv.hpp >
#include < opencv2\stitching\stitcher.hpp >
#ifdef _DEBUG
#pragma comment(lib, "opencv_core300d.lib")
#pragma comment(lib, "opencv_imgproc300d.lib") //MAT processing
#pragma comment(lib, "opencv_highgui300d.lib")
#pragma comment(lib, "opencv_stitching300d.lib")
#else
#pragma comment(lib, "opencv_core300.lib")
#pragma comment(lib, "opencv_imgproc300.lib")
#pragma comment(lib, "opencv_highgui300.lib")
#pragma comment(lib, "opencv_stitching300.lib")
#endif
using namespace cv;
using namespace std;
void main()
{
vector< Mat > vImg;
Mat rImg;
vImg.push_back(imread("./stitching_img/1.jpg"));
vImg.push_back(imread("./stitching_img/2.jpg"));
vImg.push_back(imread("./stitching_img/3.jpg"));
vImg.push_back(imread("./stitching_img/4.jpg"));
vImg.push_back(imread("./stitching_img/5.jpg"));
vImg.push_back(imread("./stitching_img/6.jpg"));
Stitcher stitcher = Stitcher::createDefault();
unsigned long AAtime = 0, BBtime = 0; //check processing time
AAtime = getTickCount(); //check processing time
Stitcher::Status status = stitcher.stitch(vImg, rImg);
BBtime = getTickCount(); //check processing time
printf("%.2lf sec \n", (BBtime - AAtime) / getTickFrequency()); //check processing time
if (Stitcher::OK == status)
imshow("Stitching Result", rImg);
else
printf("Stitching fail.");
waitKey(0);
}
但是我收到一个错误:
opencvtest1.exe 中 0x00007FFFB36A8B9C 处的第一次机会异常:Microsoft C++ 异常:内存位置 0x0000003F09CBD6B0 处的 cv::Exception。opencvtest1.exe 中 0x00007FFFB36A8B9C 处未处理的异常:Microsoft C++ 异常:内存位置 0x0000003F09CBD6B0 处的 cv::Exception。
我搜索了未处理的异常,但每个答案都提出了针对这些问题的具体解决方案,因此无法弄清楚在我的特定情况下出了什么问题。
请帮我弄清楚我在代码中做错了什么。