Unhandled exception at memory location in stitcher

2019-09-03 17:22发布

I am trying to debug the example for stitching images at this site.

Here is my complete code.

#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);

}

However I am getting an error:

First-chance exception at 0x00007FFFB36A8B9C in opencvtest1.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000003F09CBD6B0. Unhandled exception at 0x00007FFFB36A8B9C in opencvtest1.exe: Microsoft C++ exception: cv::Exception at memory location 0x0000003F09CBD6B0.

I searched for unhandled exceptions but every answer suggests specific solutions to those problems so couldn't figure out what is going wrong in my particular case.

Please help me figure out what is it that I am doing wrong in the code.

0条回答
登录 后发表回答