Windows系统基于VS2019编译器编译获得VISP动态库

官网地址:
Installation from source for Windows with Visual C++ 2019 (vc16)

In this tutorial you will learn how to install ViSP from source on Windows 10 with Visual C++. These steps have been tested on Windows 10 (64 bit) , with CMake 3.19.4 and Visual Studio Community 2019. 上面是需要满足的环境

## ‎安装先决条件‎

(补充一下,编辑文本的时候代码块用的C,所以有时候//被理解为注释了,实际上可能是在表示网址)

Visual Studio

官网:VS2019

其他的安装和平时的教程一样,唯一需要注意的就是下面的
“Desktop Development with C++" 和 "Windows 10 SDK"两个选项需要选择,如果已经安装好了可以检查一下是否勾选

选择好之后,点击右下角按钮就行了

怎么进入这个修改界面呢

点击工具第一项

出现下面界面

勾选好再点修改

正在修改

CMake

下载链接CMake

正常下载与安装

安装好打开的界面

Git

下载链接Git

This installation allows then to use git in a cmd Command Prompt.

安装教程(不需要太复杂的,这个教程比较简便清楚):

安装Git

安装完成之后,win+R再输入cmd命令回车

再输入git --version出现下面的字则表示成功

Create a workspace

If not already done, create a workspace that will contain all ViSP source, build, data set and optional 3rd parties. This workspace is here set to C:\visp-ws folder, but it could be set to any other location.

上面的步骤都完成了后,打开cmd窗口,输入命令

To create the workspace, open a cmd Command Prompt (a fast way to launch this window is to press the Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter or click/tap OK) and run the following to create a workspace environment var named VISP_WS:

C:\> setx VISP_WS "C:\visp-ws"
C:\> exit

Open a new cmd Command Prompt and create the corresponding folder
创建新的文件夹

C:\> mkdir %VISP_WS%
C:\> exit

Quick ViSP installation

快速下载

快速下载可能并不适用与我的工程,所以选择下面的下载方式
To have a trial, just jump to Install ViSP data set before running some binaries that you just build or jump to Next tutorial. You can later come back to the Advanced ViSP installation.

Advanced ViSP installation

下载第三方库

ViSP is interfaced with several 3rd party libraries. The complete list is provided here.

  1. To use optimized matrix operations you may install Eigen3 3rd party.
  2. We recommend also to install OpenCV 3rd party in the workspace.
  3. If you have an Intel Realsense depth camera you may also install
    librealsense 3rd party.
  4. If your camera is a PointGrey you may install FlyCapture 3rd party,
    while if your camera is a Basler, you may rather install Pylon 3rd
    party.
  5. Other 3rd parties are optional and should be considered only by
    expert developers.

***百度翻译:***ViSP 与几个第三方图书馆接口。‎‎完整的列表在这里提供‎‎。要使用优化的矩阵操作,您可以安装‎‎Eigen3 第三方‎‎。我们还建议在工作区安装‎‎OpenCV 第三方‎‎。如果你有一个英特尔实感深度相机,你也可以安装‎‎自由感第三方‎‎。如果你的相机是一个点灰色,你可以安装‎‎飞帽第三方‎‎,而如果你的相机是一个巴斯勒,你可能宁愿安装‎‎Pylon第三方‎‎。其他第三方是可选的,只应由专家开发人员考虑。‎

这些第三方库根据不同的需求下载
我们普通的相机应该就是选择前两个第三方库进行下载安装

Eigen3 3rd party

按照如下命令在命令窗口输入即可

Even if Eigen3 is designed as a template we recommend to install the library with Visual Studio.

Get Eigen3

Download the latest Eigen3 release from http://eigen.tuxfamily.org. At the time this tutorial was written we downloaded eigen-3.3.9.zip archive corresponding to Eigen 3.3.9.

Extract the content of the archive in %VISP_WS%.解压到创建的文件夹
Once unzipped, you should have Eigen in

%VISP_WS%\eigen-3.3.9

Build and install Eigen3 from source

Create a build directory

C:\> mkdir %VISP_WS%\eigen-3.3.9\build-vc16
C:\> cd %VISP_WS%\eigen-3.3.9\build-vc16

Run CMake in build directory (here the generator is chosen for Visual Studio 16 2019 and installation folder is set to %VISP_WS%\eigen-3.3.9\build-vc16\install folder):

C:\> cmake -G "Visual Studio 16 2019" -A "x64" %VISP_WS%\eigen-3.3.9 -DCMAKE_INSTALL_PREFIX=%VISP_WS%\eigen-3.3.9\build-vc16\install

Build and install Eigen3 (installation doesn’t need administrator privileges)

C:\> cmake --build . --config Release --target install

Eigen3 is now installed in %VISP_WS%\eigen-3.3.9\build-vc16\install folder

Complete Eigen3 installation

Now you have to complete Eigen3 installation setting some environment vars:

In order that ViSP detects Eigen3 you have to set EIGEN_DIR environment variable. Start up a cmd Command Prompt and enter:

C:\> setx Eigen3_DIR "%VISP_WS%\eigen-3.3.9\build-vc16\install\share\eigen3\cmake"
C:\> exit

where %VISP_WS%\eigen-3.3.9\build-vc16\install is where you have installed Eigen3. Inside the folder %VISP_WS%\eigen-3.3.9\build-vc16\install\share\eigen3\cmake you should have a file named Eigen3Config.cmake.

There is no need to set Path environment var since Eigen3 is a template that has no library.

OpenCV 3rd party

1,先解压到上面的文件夹,正常的opencv按照操作

建议和原文一样用4.5.1版本

注意:这里是已经安装git之后,用命令行实现的。
如果没有下载git,就可以用CMake来编译,具体见另一篇:
32位的OpenCV库怎么生成得到并配置环境变量

下载链接:

Opencv

正在解压(还是我们说过的上面的那个文件夹中)

Note注意事项
OpenCV 4.5.1 win pack installer doesn’t contain prebuild OpenCV libraries build with Visual Studio 16 2019. It contains only prebuild libraries build with previous Visual Studio version (vc14 and vc15). That’s why we need to build OpenCV from source.(解释了一下为什么进行下面的操作)

Build OpenCV from source

Create a build directory

C:\> mkdir %VISP_WS%\opencv-4.5.1\build-vc16
C:\> cd %VISP_WS%\opencv-4.5.1\build-vc16

Run CMake in build directory (here the generator is chosen for Visual Studio 16 2019) and installation dir is set to the existing folder %VISP_WS%\opencv-4.5.1\build:

C:\> cmake -G "Visual Studio 16 2019" -A "x64" %VISP_WS%\opencv-4.5.1\sources -DCMAKE_INSTALL_PREFIX=%VISP_WS%\opencv-4.5.1\build

Build and install OpenCV using release and debug configuration respectively (installation doesn’t need administrator privileges)
下面是Release和Debug的

C:\> cmake --build . --config Release --target install
C:\> cmake --build . --config Debug --target install

一些过程(需要挺多的时间):


过了大概十分钟完成再输入了第二条

Complete OpenCV installation
后面的操作用于完成安装

Now you have to complete OpenCV installation setting some environment vars:

In order that ViSP detects OpenCV you have to set OpenCV_DIR environment variable. (设置路径为了让VISP能够识别到Opencv)

Start up a cmd Command Prompt and enter:

C:\> setx OpenCV_DIR "%VISP_WS%\opencv-4.5.1\build"
C:\> exit

where %VISP_WS%\opencv-4.5.1\build is where you have installed OpenCV. Inside this folder you should have a file named OpenCVConfig.cmake.

You have also to add the location of OpenCV libraries corresponding to Visual Studio 16 2019 usage in the Path environment variable.(为VS添加opencv路径)

Open the “Edit environment variable” UI, and modify Path to add a new line with %VISP_WS%\opencv-4.5.1\build\x64\vc16\bin.

(另外的几个第三方库是特定的相机(英特尔实感深度相机,巴斯勒相机等)使用的,需要的可以在官网查看)

最后效果如图:


上面这样就完成了我对这两个库的添加,接下来开始添加VISP

Get ViSP source code

可以直接使用cmd命令:

C:\> cd %VISP_WS%
C:\> git clone https://github.com/lagadic/visp.git

输入后界面

上面的命令运行完了后就可以了,下面的是同样的效果,我觉得用命令行方便

也可以下载zip等文件
地址:VISP

也可以下载tar.gz文件
地址:VISP

下载好了:

Configure ViSP from source

编译文件

先新建一个文件夹

打开CMake
如图输入

按下Configure

按下Finish
‎这将启动CMake配置。如下一张图片所示,自动检测到 Eigen3、飞帽、GDI(图形设备界面)、OpenCV、OpenMP、Pylon 和 Realsense2 第三方。

Warning

报这个错就按照下面的方法重新来

If you forgot to set Eigen3_DIR environment var, you will get the following warning in cmake_gui:

CMake Warning at CMakeLists.txt:1156 (message):Eigen3 config file is detected in C:/visp-ws/eigen-3.3.9/build-vc16.  UsingC:/visp-ws/eigen-3.3.9/build-vc16/Eigen3Config.cmake doesn't allow to use avalid Eigen3 include dir: C://include/eigen3.  Modify Eigen3_DIR to pointto Eigen3Config.cmake file located in Eigen3 installation folder or turnUSE_EIGEN3 OFF.

We strongly recommend to fix this warning. To this end:

  1. close cmake-gui
  2. set Eigen3_DIR environment var running setx Eigen3_DIR
    “%VISP_WS%\eigen-3.3.9\build-vc16\install\share\eigen3\cmake”
  3. open again cmake-gui
  4. delete the cache using menu File > Delete Cache
  5. and configure again ViSP.

At this point, you should no more see the warning.

再一次按下Configure

都正常了

再按下Generate,再文件夹中就有了VISP.sln文件

又出了一个问题,我的工程要在X86上跑,所以前面的有个地方要改,不过后面要转到X64,这个也留着吧。我再创建了一个文件夹,编译出X86的,就不重复了,就是CMake那一步选编译器的那一步选Win32就行了


打开了sln文件:

按下第一个

正在编译


我是win32的所以编译出来的动态库在这里

官方的用X64的编译完成如下图

还有一步很重要的内容
我给漏了这一步,然后失败了
需要找到这个文件,再右击生成

这样才有install文件夹

所以后续步骤有一些我要重来

Build ViSP documentation

***先要下载一个软件:***Doxygen

To build ViSP documentation, you have first to install Doxygen:

Download binary distribution for Windows. At the time this tutorial was written, we downloaded doxygen-1.8.20-setup.exe

Run the installer following default options

Open a new cmd Command Prompt and enter build directory

C:\> cd %VISP_WS%\visp-build-vc16

Run CMake in build directory:

C:\> cmake -G "Visual Studio 16 2019" -A "x64" %VISP_WS%\visp

Build documentation using:

C:\> cmake --build . --config Release --target visp_doc

Win32的命令稍微改一下

Debug模式也要改一下

生成的文件
也就是线上的一个帮助文档

Set Path environment var

注意下面的都是X64的

就可以配置动态库了,可以像别的方法一样打开VS配置比如添加%VISP_WS%\visp-build-vc16\install\x64\vc16\bin
也可以用命令行配置。

C:\> setx Path "%Path%:%VISP_WS%\visp-build-vc16\install\x64\vc16\bin"
C:\> exit

Set VISP_DIR environment var

‎为了便于 CMake 在外部项目中用作第三方时,CMake 检测到 VISP,例如教程中描述的项目‎‎:如何在 Unix 或 Windows 上创建和构建使用 ViSP 和 CMake 的项目‎‎,您可以设置与文件路径相同的环境变量:‎VISP_DIRVISPConfig.cmake

C:\> setx VISP_DIR "%VISP_WS%\visp-build-vc16\install"
C:\> exit

也就是相当于自己设置(下面对应的增加两项路径):

Install ViSP data set

有一些VISP例子需要使用到一些图片和数据之类的

这里只介绍git的方法:

C:\> cd %VISP_WS%
C:\> git clone https://github.com/lagadic/visp-images.git

运行中:

下载完成

为了让VISP识别到图片,输入:

C:\> setx VISP_INPUT_IMAGE_PATH %VISP_WS%\visp-images
C:\> exit


也就相当于自己复制进去设置路径:

Test data set usage

一些简单的用法,可以测试是否安装成功

还需要注意一个:为了让VISP识别OpenCV,添加OpenCV的一个路径(在上面那一篇文章里面有):


或者添加这个也行(就不用上面那个)也行:

如果你想要运行%VISP_WS%\visp-build-vc15\example\device\display\Release\displayGDI.exe
输入下面代码

C:\> cd %VISP_WS%\visp-build-vc15\example\device\display\Release
C:\> displayGDI.exeA click to close the windows...A click to display a cross...
Cross position: 392, 306A click to exit the program...
Bye

如图:

我输入的是另一个,大家可以看一下

Tips and tricks

How to take into account a newly installed 3rd party
Since all 3rd parties are optional you may have started to install only some of them. Imagine that you just installed a new third-party, or that you upgraded the version of this 3rd party. The next step is to go back to the build folder, configure ViSP with CMake to detect the newly installed third-party library and build again ViSP. This could be achieved with:

$ cd $VISP_WS/visp-build-msvc16
$ cmake ../visp

Here you can check the content of the ViSP-third-party.txt file and see if the newly installed 3rd party is well detected.

Finally, you need to rebuild and install ViSP with:

$ cmake --build . --config Release --target install

How to uninstall ViSP
After ViSP installation, you can remove installed material using:

$ cd $VISP_WS/visp-build-msvc16
$ cmake --build . --config Release --target uninstall

How to build only ViSP libraries
If you want to build only ViSP modules libraries, nor the examples, tutorials and tests:

$ cd $VISP_WS/visp-build-msvc16
$ cmake --build . --config Release --target visp_modules

How to build a ViSP specific module
If you want to build a given module and all the dependencies:

$ cd $VISP_WS/visp-build-msvc16
$ cmake --build . --config Release --target visp_<module_name>

For example to build the model-based tracker module named mbt, run:

$ cd $VISP_WS/visp-build-msvc16
$ cmake --build . --config Release --target visp_mbt

ViSP安装之Windows系统基于VS2019编译器编译获得VISP动态库相关推荐

  1. 【Python】Python下载及安装(windows系统)

    Python下载及安装(windows系统) 下载安装包 安装程序 配置PATH 其他问题 下载安装包 浏览器访问下载地址,下载windows的最新版本 安装程序 双击程序安装 1.立即安装,会直接在 ...

  2. Windows系统使用minGW+msys 编译ffmpeg 0.5的全过程详述

    一.环境配置 1.下载并安装 MinGW-5.1.4.exe (http://jaist.dl.sourceforge.net/sourcef - -5.1.4.exe),安装时选中 g++, min ...

  3. 【Android 逆向】修改运行中的 Android 进程的内存数据 ( Android 系统中调试器进程内存流程 | 编译内存调试动态库以及调试程序 )

    文章目录 一.Android 系统中调试器进程内存流程 二.编译内存调试动态库以及调试程序 三.博客资源 一.Android 系统中调试器进程内存流程 修改游戏运行中的内存 , 游戏运行之后 , 游戏 ...

  4. 关于如何在XP系统上运行opencv生成的C++动态库

    先讲下为什么要在xp系统上运行opencv生成的C++动态库,原因是我做了一个图像检测项目,使用C#编写的,C#里有个opencvsharp图像处理包,对于C#程序员调用在舒服不过了,但是!客户比较守 ...

  5. Node环境的配置与安装(windows系统)(超详细)

    步骤一:下载安装包 在github上进行下载nvm-windows安装包,下载地址为 https://github.com/coreybutle....可以选择最新版本当中的第一个压缩包 nvm-no ...

  6. 计算机系统字体安装程序,windows系统字体安装方法:使用字体安装软件-windows技巧-电脑技巧收藏家...

    windows系统字体安装方法:使用字体安装软件 如果给系统中安装数百上千个字体的话,那么不仅会让系统变得很慢,设计.应用软件的稳定性也很成问题.退一步说,要在AI.PS等软件的上千种字体下拉框里找到 ...

  7. win7原版镜像_U盘安装原版Windows系统,必备技能,零基础学装系统,再也不求人...

    光盘装系统的时代已经成为历史,现在很少有电脑和笔记本提供支持光驱了.虽然用Ghost装系统方便又快速,但始终是克隆的别人系统.用ISO原版安装的系统无疑是最干净.最安全.功能最强大.体质最健康.最纯洁 ...

  8. Visual studio Code安装?Swift for Windows安装?Windows系统下编写Swift?怎么执行?

    Windows系统下编写swift?如何配置环境? 一.安装Visual Studio Code 1.浏览器输入网址或点击链接下载https://code.visualstudio.com/ 根据自己 ...

  9. windows系统OLLVM + NDK 混淆编译环境搭建

    一.环境搭建: 系统:win10_X64 ndk版本:ndk-r12b(ndk-r12b后续版本也适用) cmake-3.9.1-win64-x64.msi  用于针对不同编译器生成源代码构建文件,如 ...

最新文章

  1. 6个快速优化回归测试套件的方法,你都知道吗?
  2. debian8下给postgresql9.5编译配置pgpool-II-3.5
  3. etcdctl命令查询etcd信息
  4. Cascade R-CNN的一些记录
  5. 160809230张钊
  6. 【CodeForces - 347C 】Alice and Bob (思维,数学,等差数列)
  7. 程序员面试金典 - 面试题 16.16. 部分排序(排序/不排序)
  8. 力扣Java编译器_力扣(LeetCode)位1的个数 个人题解
  9. 【BZOJ3505】[Cqoi2014]数三角形 组合数
  10. CM/CMR/CMP防火等级有何区别?CM/CMR/CMP级电缆网线如何选?
  11. 银联支付接口申请流程
  12. python正则取反,一文搞定Python正则表达式
  13. K米在线超市实施步骤及检查列表
  14. centos配置虚拟主机(站点)
  15. 联想服务器如何修改硬盘模式,联想thinkpad如何修改硬盘模式为ahci
  16. (自兴人工智能)python元组
  17. Ubuntu 20.04.2.0 LTS 下Geany 1.36的“编译文件”和“生成当前文件”两个按键不可用
  18. ESM2蛋白预训练模型 蛋白质、氨基酸向量表示
  19. 设置VSS2005使支持通过Internet访问
  20. 火车头采集翻页内容_八爪鱼采集器 循环翻页只翻3、5页就提示采集结束

热门文章

  1. Java基础学习总结(26)——JNDI入门简介
  2. Java学习笔记(1)——概述
  3. 打开某网站无法访问出现空白页可能的原因
  4. Linux的MySQL不能远程访问
  5. Spring事务传播性与隔离级别
  6. C# socket 解析http 协议
  7. BERT模型从训练到部署全流程
  8. 优化算法optimization:AdaDelta
  9. Xshell6和Xftp下载地址,rzsz的使用
  10. sqlserver bulk insert