OpenCV 拼接,C++ - 未处理的异常

OpenCV Stitching, C++ - Unhandled exception

本文关键字:未处理 异常 C++ 拼接 OpenCV      更新时间:2023-10-16

我试图将三个图像拼接在一起。为此,我选择了OpenCV 2.4.10和Microsoft Visual C++ 2010 Express。
图像为1500x1500像素,读取时为CV_8UC3。
我正在构建 32 位,并且已经获得了一些使用 OpenCV 的其他东西,所以我想该项目已使用路径等正确设置。

奇怪的是,我只是偶尔收到此错误,并且只有当我尝试拼接两个以上的图像时。

这里是错误消息:

拼接测试中0x5841dcaa未处理的异常.exe: 0xC0000005:访问违规读取位置0x00000004。

之后,我会自动进入"Chores.cpp"的第 99 行或"TaskCollection.cpp"的第 189 行,所以我认为这是错误的根源。(路径 C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src)

这是代码:

#include <iostream>
//OPENCV
#include <opencv2corecore.hpp>
#include <opencv2highguihighgui.hpp>
#include <opencv2imgprocimgproc.hpp>
//OPENCV STITCHING
#include <opencv2stitchingstitcher.hpp>
using namespace std;
using namespace cv;
int main(){
    Mat panoramaImage;
    vector<Mat> inputImages;
    inputImages.push_back(imread("../../V1.bmp"));
    inputImages.push_back(imread("../../V2.bmp"));
    inputImages.push_back(imread("../../V3.bmp"));
    Stitcher stitcher = Stitcher::createDefault();
    Stitcher::Status stitcherStatus = stitcher.stitch(inputImages, panoramaImage);
    imshow("Stitching Result", panoramaImage); 
    waitKey(0);
    return 0;
}

有人有建议吗?

问题已解决 - 我发现在发布时,我的预处理器定义中有"_DEBUG;"。仍然很奇怪,错误只是偶尔发生...