0

我正在为我的论文尝试 OpenCV 库。我已经应用了http://opencv-srf.blogspot.com/2013/05/installing-configuring-opencv-with-vs.html给出的步骤我的问题是构建成功后我真的认为代码应该可以正常运行. 请告诉我问题所在。谢谢 :)

代码:

#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include <iostream>

using namespace cv;
using namespace std;

int main( int argc, const char** argv )
{
     Mat img(500, 1000, CV_8UC3, Scalar(0,0, 100)); //create an image ( 3 channels, 8 bit image depth, 500 high, 1000 wide, (0, 0, 100) assigned for Blue, Green and Red plane respectively. )

     if (img.empty()) //check whether the image is loaded or not
     {
          cout << "Error : Image cannot be loaded..!!" << endl;
          //system("pause"); //wait for a key press
          return -1; 
     } 

     namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
     imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window

     waitKey(0);  //wait infinite time for a keypress

     destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"

     return 0;
}

构建:1>----- 构建开始:项目:ConsoleApplication1,配置:调试 Win32 ------ 1> ConsoleApplication1.cpp 1> ConsoleApplication1.vcxproj -> D:\Visual Studio\Projects\Project2\new \ConsoleApplication1\Debug\ConsoleApplication1.exe ========== 构建:1 成功,0 失败,0 最新,0 跳过 ==========

调试:“ConsoleApplication1.exe”(Win32):已加载“D:\Visual Studio\Projects\Project2\new\ConsoleApplication1\Debug\ConsoleApplication1.exe”。已加载符号。“ConsoleApplication1.exe”(Win32):已加载“C:\Windows\SysWOW64\ntdll.dll”。已加载符号。“ConsoleApplication1.exe”(Win32):已加载“C:\Windows\SysWOW64\kernel32.dll”。已加载符号。“ConsoleApplication1.exe”(Win32):已加载“C:\Windows\SysWOW64\KernelBase.dll”。已加载符号。程序“[4136] ConsoleApplication1.exe”已退出,代码为 -1073741701 (0xc000007b)。

4

1 回答 1

1

NTSTATUS的代码0xC000007BSTATUS_INVALID_IMAGE_FORMAT。您的程序很可能是 32 位的,并且正在尝试加载 64 个 DLL。鉴于您提到 OpenCV,我怀疑 OpenCV DLL 是其根源。

解决方案:

  1. 确保您的进程找到 32 位版本的 DLL。
  2. 将您的项目切换到目标 64 位。
于 2013-06-24T10:19:17.243 回答