Visual Servoing Platform
version 3.2.0 under development (2019-01-22)
|
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.13.1 and Visual Studio 2015.
Install Visual Studio 2015. After the installation, start Visual Studio and create an empty C++ project to install the common tools for Visual C++ 2015. The next image shows which are the workloads that we enable:
Then install Windows Software Developement Kit (SDK) for Windows 10. This SDK could be downloaded from https://dev.windows.com/en-US/downloads/windows-10-sdk. This SDK is requested by ViSP and allows also to get the Graphical Device Interface (GDI) capabilities. The GDI is used in ViSP to display images in a window thanks to vpDisplayGDI class.
CMake could be download from http://www.cmake.org. Download the latest release for Windows win64-x64 platform (at the time this tuto was written it was the file cmake-3.13.1-win64-x64.msi
). To install just double click on the msi file.
Install Git for Windows from https://git-for-windows.github.io/. This installation allows then to use git in a cmd
Command Prompt.
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.
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
:
Open a new cmd
Command Prompt and create the corresponding folder
In this section, we give minimal instructions to build ViSP from source just to try ViSP without entering in Advanced ViSP installation.
cmd
Command Prompt and get ViSP source code in the workspace %VISP_WS%\visp-build-vc14\install
folderPath
var to add %VISP_WS%\visp-build-vc14\install\x64\vc14\bin
corresponding to the path to ViSP libraries.VISP_DIR
var to help CMake to find ViSP as a 3rd party setx
command is not able to handle a var that has more than 1024 characters (which could be the case of Path
var), to modify Path
environment variable do the following:%VISP_WS%\visp-build-vc14\install\x64\vc14\bin
To have a trial, just jump to Install ViSP dataset before running some binaries that you just build or jump to Next tutorial. You can later come back to the Advanced ViSP installation.
ViSP is interfaced with several 3rd party libraries. The complete list is provided here. We recommend to install OpenCV 3rd party and libxml2 3rd party in the workspace. If you have an Intel Realsense depth camera you may also install librealsense 3rd party. 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. If you want to be able to detect a QR code you may install zbar 3rd party. To use optimized matrix operations you may install eigen 3rd party. Other 3rd parties are optional and should be considered only by expert developers.
1. Get OpenCV
First you have to get OpenCV:
opencv-4.0.0-vc14_vc15.exe
Win pack installer. The same procedure could be applied with the previous OpenCV 3.4.0 release downloading opencv-3.4.0-vc14_vc15.exe
.%VISP_WS%
. %VISP_WS%\opencv
.%VISP_WS%\opencv-4.0.0
.%VISP_WS%\opencv-4.0.0\build\x64\vc14
and %VISP_WS%\opencv-4.0.0\build\x64\vc15
respectively.2. Complete OpenCV installation
Now you have to complete OpenCV installation setting some environment vars:
OpenCV_DIR
environment variable. Start up a cmd
Command Prompt and enter: %VISP_WS%\opencv-4.0.0\build
is where you have installed OpenCV. Inside this folder you should have a file named OpenCVConfig.cmake
.Path
environment variable. Open the "Edit environment variable" UI, and modify Path
to add a new line with %VISP_WS%\opencv-4.0.0\build\x64\vc14\bin
.1. Get libxml2
libxml2-2.9.8.tag.gz
file.%VISP_WS%
. Winrar could be used to this end.%VISP_WS%\libxml2-2.9.8
folder.2. Build and install libxml2 from source
%VISP_WS\libxml2-2.9.8\build\vc14\bin\libxml2.dll
3. Complete libxml2 installation
XML2_DIR
environment variable: Path
environment variable. Open the "Edit environment variable" UI, and modify Path
to add a new line with %VISP_WS%\libxml2-2.9.8\build-vc14\bin
.I you have an Intel RealSense Depth camera (SR300 or D400 series), you may install librealsense 2.x in order to use vpRealSense2 class. Otherwise you can skip this section.
Installation instructions are given in the tutorial. We recall the main steps here:
1. Get librealsense
cmd
Command Prompt and get ViSP source code in the workspace 2. Build and install librealsense from source
%VISP_WS%\librealsense\build-vc14
folder3. Complete librealsense installation
REALSENSE2_DIR
environment variable: Path
environment variable. Open the "Edit environment variable" UI, and modify Path
to add a new line with %VISP_WS%\librealsense\build-vc14\bin
.I you have a PointGrey or FLIR USB 2.0, USB 3.0, GigE or FireWire camera (DragonFly2, Flea3...), you may install FlyCapture. Otherwise you can skip this section.
Complete installation instructions are given here. We recap hereafter the main instructions to install FlyCapture SDK under Windows:
FlyCapture_2.11.3.164_x64.exe
file.I you have a Basler FireWire, Camera Link, GigE or USB3.0 camera, you may install Pylon SDK. Otherwise you can skip this section.
To install Pylon:
Basler_pylon_5.0.11.10913.exe
file.C:\Program Files\Basler\pylon 5\
and click on "Next" buttonIf you want to work with QR codes (see Tutorial: Bar code detection), we recommend to install zbar 3rd party. Otherwise you can skip this section.
To install zbar you need to build the library from source. There is a fork of the library available from GitHub (https://github.com/dani4/ZBarWin64) and adapted for compiling under Visual following the steps:
1. Get zbar
cmd
Command Prompt and hit: 2. Build zbar from source
%VISP_WS%\ZBarWin64\zbar64.sln
solution file with Visual Studio C++"Release"
and "x64"
configuration. Then to build zbar library enter menu "Build \> Build Solution"
or hit "Ctrl+Shift+B". 3. Complete zbar installation
ZBAR_DIR
environment variable: Path
environment variable. Open the "Edit environment variable" UI, and modify Path
to add 2 new lines, one with %VISP_WS%\ZBarWin64\x64\Release
, another with %VISP_WS%\ZBarWin64\zbar\libiconv\dll_x64
.Even if eigen is designed as a template we recommend to install the library with Visual Studio.
1. Get eigen
eigen-eigen-b3f3d4950030.tar.gz
tarball corresponding to eigen 3.3.5.%VISP_WS%
.%VISP_WS%\eigen-eigen-b3f3d4950030
in %VISP_WS%\eigen-3.3.5
2. Build and install eigen from source
%VISP_WS%\eigen-3.3.5\build-vc14\install
folder): %VISP_WS%\eigen-3.3.5\build-vc14\install
folder3. Complete eigen installation
Now you have to complete eigen installation setting some environment vars:
EIGEN_DIR
environment variable. Start up a cmd
Command Prompt and enter: %VISP_DIR%\eigen-3.3.5\build-vc14\install
is where you have installed eigen. Inside this folder you should have a file named Eigen3Config.cmake
.Path
environment var since eigen is a template that has no library.There are different ways to get ViSP source code.
visp-x.y.z.tar.gz
or visp-x.y.z.zip
is downloaded, uncompress the file in %VISP_WS%\visp\visp-x.y.z
using for axample WinRAR.%VISP_WS%\visp\visp-x.y.z
using for axample WinRAR.git
command line tool: We suppose now that ViSP source is in %VISP_WS%\visp
.
The goal of the configuration step is now to use CMake to produce a Visual Studio C++ solution file that will be located in %VISP_WS%/visp-build-vc14
.
%VISP_WS%/visp-build-vc14
folder.%VISP_WS%/visp-build-vc14/install
. If you want to change the installation folder to C:\Program Files (x86)\ViSP
, make sure that you have administrator privileges to write in that folder before modifying CMAKE_INSTALL_PREFIX
..dll
extension). This is the default configuration that is recommended. If you want to create rather a static library (with .lib
extension) you have to uncheck the BUILD_SHARED_LIBS
option to disable DLL creation.%VISP_WS%/visp-build-vc14
folder you have the Visual Studio VISP.sln
generated solution file.%VISP_WS%/visp-build-vc14/VISP.sln
solution file. This action will open ViSP project in Visual Studio C++. By default, Visual Studio opens the solution in Debug
configuration. Modify the configuration to "Release"
. "Build \> Build Solution"
to build ViSP or hit "Ctrl+Shift+B"."INSTALL"
project. To this end, apply a left click on "INSTALL"
to select the project, then a right click to enter in the "Build" menu. %VISP_WS\visp-build-vc14\install
folder; headers and libraries in include
and x64/vc14
subfolders respectively."Release"
configuration. Now in %VISP_WS%/visp-build-vc14/install/x64/vc14/bin
folder you have ViSP DLL libraries corresponding to ViSP modules. Debug
configuration. In that case, all the library names are suffixed by "d" character (libvisp_core320d.dll
...).Modify the Path
var to add the path to ViSP dll libraries. To this end open the "Edit environment variable" UI, and modify Path
to add a new line with %VISP_WS%\visp-build-vc14\install\x64\vc14\bin
.
In order to ease ViSP detection by CMake when ViSP is used as a 3rd party in an external project, like the one described in the Tutorial: How to create and build a CMake project that uses ViSP on Unix or Windows, you may set VISP_DIR
environment variable with the path to the VISPConfig.cmake
file:
Some ViSP examples and tests require data (images, video, models) that are not part of ViSP source code but available in a separate archive named visp-images-x.y.z.zip
. This archive could be downloaded from http://visp.inria.fr/download page. We provide here after the way to install these data if you want to run ViSP examples or tests. Note that ViSP tutorials are not using ViSP data set.
visp-images-3.2.0.zip
from https://visp.inria.fr/download and uncompress it in your workspace %VISP_WS%
. VISP_INPUT_IMAGE_PATH
. In our case, this variable should be set to %VISP_WS%\visp-images-3.2.0
. Open a cmd
Command Prompt and run %VISP_WS%\visp-build-vc14\example\device\display\Release\displayGDI.exe
, open a cmd
Command Prompt, enter in the right folder and run: If one of the following command lines are not working:
it may possible that you have more then one Visual Studio version installed on your system.
To select Visual Studio 2015 (vc14) you may open a cmd
Command Prompt, enter in the corresponding Visual Studio folder and run vcvarsall.bat
:
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:
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:
After ViSP installation, you can remove installed material using:
If you want to build only ViSP modules libraries, nor the examples, tutorials and tests:
If you want to build a given module and all the dependencies:
For example to build the model-based tracker module named mbt, run:
To see which are the optional 3rd parties that are found during the configuration stage and that will be used by ViSP during the build you can have a look to the text file named ViSP-third-party.txt
and located in $VISP_WS/visp-build
. We provide hereafter an example of a possible content of this file that contains also build info.
You are now ready to see the next Tutorial: How to create and build a CMake project that uses ViSP on Unix or Windows that will show you how to use ViSP as a 3rd party to build your own project.