0

我使用 Visual Sudio 10 作为 IDE(在 windows 7 64 位上)安装了 OpenCV 版本 2.4.3。问题是,一旦我安装了它并且正在运行一个简单的应用程序,比如加载图像,它就会给我一个错误

The program '[8120] pms1.exe: Native' has exited with code -1073741811 (0xc000000d)

对于我尝试运行的任何代码,我都会遇到相同的错误。我没有收到任何构建错误。构建成功,但是当我运行它时,它会抛出这个。

注意:给我错误的示例代码

#include <opencv\cv.h>
#include <opencv\highgui.h>
using namespace cv;

int main()
{
  Mat image;

  VideoCapture cap;
  cap.open(0);

  namedWindow(“window”, 1);

  while(1) {
    cap>>image;

    imshow(“window”, image);
    waitKey(33);
  }

  return 0; 
}
4

2 回答 2

0

确保您的可执行文件和它调用的 opencv dll 文件都是 32 位或 64 位的。

于 2013-04-08T23:50:05.283 回答
0

很可能是捕获接口无法打开设备0,因此cap>>image;可能是导致错误的原因。你只是不知道它,因为你忘记检查成功open()

VideoCapture cap;
cap.open(0);
if (!cap.isOpened())
{
     // print error message and 
     // quit the application
}

尝试为 传递其他值open(),例如 -1 或 2。

于 2013-04-09T02:19:08.430 回答