zoukankan      html  css  js  c++  java
  • Win7/Win10+VS2017+OpenCV3.4.2安装、测试

    安装VS2017

    1. 在微软官网https://www.microsoft.com,下载Visual Studio 2017安装包
    2. 用管理员权限运行vs2017 enterprise安装包,安装过程会持续1~2个小时。
    3. 注册激活,此注册码来源于网上,如有侵权,请告知本人妥善处理:
      1. Enterprise: NJVYC-BMHX2-G77MM-4XJMR-6Q8QF
      2. Professional:  

        KBJFW-NXHK6-W4WJM-CRMQB-G3CDH

    4. 测试安装结果:启动VS2017,新建工程,并编译运行。

    安装OpenCV3.4

    1. 在github官方仓库https://github.com/opencv/opencv/releases,下载OpenCV3.4.2
    2. 安装(解压)到C:
    3. 配置OpenCV环境变量:
      1. 右键Computer -> Properties -> Advanced system settings -> Environment variables
      2. System variables -> New -> 输入OPENCV和目录C:opencvuild
      3. System variables -> Path -> 添加%OPENCV%x64vc15in;

    配置VS2017工程+案例测试

    1. 新建工程取名test。注意,此安装包是x64版本,用32位程序编译报错。
    2. 配置OpenCV库,View -> Other Window -> Property Manager,选中Debug|x64 -> Microsoft.Cpp.x64.user -> Properties,在此选项卡中配置如下参数。
      1. VC++ Directories -> Include Directories -> 添加C:opencvuildinclude
      2. VC++ Directories -> Library Directories -> 添加C:opencvuildx64vc15lib
      3. Linker -> Input -> Additional Dependencies -> 添加opencv_world342.lib
    3. 编辑代码
      #include<iostream>
      #include <opencv2/opencv.hpp>
      using namespace cv;
      
      int main()
      {
          Mat img = imread("test_image.jpg"); // 读入一张图片,图片与test.cpp同一目录
          namedWindow("test_image", cv::WINDOW_NORMAL); // 创建一个名为 "test_image" 的窗口
          imshow("test_image", img); // 在窗口中显示
          waitKey();
      
          return 0;
      }
    4. 编译运行,提示an error has occurred in the script on this page  expected identifier string or number,解决办法:
      1. Debug -> Debugging -> General ->  取消Enable Diagnostic Tools while debugging -> OK保存
      2. 重启VS2017,已解决
    5. 运行结果如下,图片来源于网络,如有侵权,请告知本人妥善处理。

     

  • 相关阅读:
    《剑指offer》第十二题(矩阵中的路径)
    《剑指offer》第十五题(二进制中1的个数)
    《剑指offer》第十题(斐波那契数列)
    《剑指offer》第十一题(旋转数组的最小数字)
    原始的生成对抗网络GAN
    《剑指offer》第九题(用两个栈实现队列)
    (转)c++一些知识点
    贪心算法
    动态规划——最长公共子串
    动态规划——主元素算法
  • 原文地址:https://www.cnblogs.com/xbit/p/9328066.html
Copyright © 2011-2022 走看看