OpenCV -Visual Studio 2015

mrt*_*sln 2 opencv visual-studio-2015

我正在使用Visual Studio 2015工作OpenCv 2.4.11版本.当我尝试示例代码时,我得到"应用程序无法正确启动0xc00007b"错误.我的代码如下:

#include "stdafx.h"
#include <iostream>

#include <opencv2\opencv.hpp>

using namespace std;
using namespace cv;


int main(int argc, char** argv) {
    Mat img = imread("C:/Users/Murat/Desktop/lena1.png");

    if (img.empty()) {
        cout << "Resim yüklenemedi" << endl;
        return -1;

    }
    namedWindow("deneme penecere ismi", CV_WINDOW_AUTOSIZE);
    imshow("deneme penecere ismi", img);
    waitKey(0);
    destroyWindow("deneme penecere ismi");


    return  0;
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决问题.

小智 6

首先使用Visual Studio 2015编译器从源代码构建OpenCV.这样可以降低计算机中缺少旧框架的风险.您需要vc14目录作为libs的源.预构建的库仅适用于VS 2012和2013,它们是opencv/build/x64或x86下的VC11和VC12库文件夹.

步骤很简单.

  1. 下载CMAKE,安装.
  2. 下载Opencv的源代码,解压缩.
  3. 运行Cmake并为项目添加源目录和目标目录.
  4. 配置Cmake,首先选择正确的编译器VS2015.有很多选择.只需先尝试默认值.
  5. 运行Cmake.结果是目标目录下的opencv.sln之类的Visual Studio 2015项目.
  6. 打开opencv.sln项目.
  7. 使用Visual Studio 2015构建此项目.

结果是包含libs的VC14目录.

按照图片教程查看此图片.教程在这里