在stitcher code opencv中内存位置的未处理异常

时间:2015-09-07 07:59:28

标签: c++ opencv unhandled-exception opencv-stitching

我正在尝试调试在this站点缝合图像的示例。

这是我的完整代码。

#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 ++异常:cv ::内存位置的异常   0x0000003F09CBD6B0。 0x00007FFFB36A8B9C中的未处理异常   opencvtest1.exe:Microsoft C ++异常:cv ::内存异常   location 0x0000003F09CBD6B0。

我搜索了未处理的异常,但每个答案都提出了针对这些问题的具体解决方案,因此无法弄清楚在我的特定情况下出了什么问题。

请帮我弄清楚我在代码中做错了什么。

0 个答案:

没有答案