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. 运行结果如下,图片来源于网络,如有侵权,请告知本人妥善处理。

     

  • 相关阅读:
    JS-只能输入中文和英文
    强密码正则表达式
    java 实体序列化的意义
    数据库中存在0,1,2.....或者1,null,2 排序时让0或者null在最后的sql语句
    Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile 解决办法
    C#中的线程(二) 线程同步基础
    C#中的线程(一)入门
    C#多线程编程
    C#(asp.net )读取ASHX文件(一般处理程序)
    Oracle中三种循环(For、While、Loop)
  • 原文地址:https://www.cnblogs.com/xbit/p/9328066.html
Copyright © 2011-2022 走看看