繁体   English   中英

OpenCV-Visual Studio 2015年

[英]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;
}

我该如何解决问题。

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

步骤很简单。

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

结果是带有要包含的库的VC14目录。

通过图片教程检查该图片。 教程在这里

配置步骤:

1-将bin目录中的dll添加到系统路径。

2-将include目录添加到项目属性-> VC ++目录-> include

3-将lib目录中的'.lib'文件添加到项目属性->链接器->其他依赖项

解释链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM