Visual Servoing Platform
version 3.1.0
|
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.10.0 and Visual Studio Community 2015.
cmake-3.10.0-rc3-win64-x64.msi
). To install just double click on the msi file.First create a workspace that will contain all ViSP and optional 3rd parties. This workspace is here set to C:\workspace
folder, but it could be set to any other location. To create the workspace:
cmd
terminal (in your "Start" menu click on "Run" and type in cmd.exe
) and run: 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-3.3.1-vc14.exe
Win pack installer. The same procedure could be used to consider rather OpenCV 3.3.0 by downloading opencv-3.3.0-vc14.exe
Win pack installer.C:\workspace
. C:\workspace\opencv
.C:\workspace\opencv-3.3.1
.OpenCV 3.3.1 windows installer contains pre-build libraries compatible with Visual C++ 2015 (vc14) in C:\workspace\opencv-3.3.1\build\x64\vc14
. That is why there is no need to build OpenCV from source for vc14 as it is done in Tutorial: Installation from source for Windows with Visual C++ 2017 (vc15).
2. Complete OpenCV installation
Now you have to complete OpenCV installation setting some environment vars:
OpenCV_DIR
environment variable. Start up a cmd
terminal and enter: C:\workspace\opencv-3.3.1\build
is where you have installed OpenCV. Inside this folder you should have a file named OpenCVConfig.cmake
.1. Get libxml2
libxml2-2.9.7.tag.gz
file.C:\workspace
. Winrar could be used to this end.C:\workspace\libxml2-2.9.7
folder.2. Install libxml2
C:/workspace/libxml2-2.9.7/build/vc14/bin/libxml2.dll
3. Complete libxml2 installation
XML2_DIR
environment variable: I you have an Intel RealSense Depth camera (F200, SR300, R200, LR200, ZR300, and D400 series cameras), you may install librealsense 1.12.1. Otherwise you can skip this section.
1. Get librealsense 1.12.1
C:\> cd C:\workspace C:\> git clone https://github.com/IntelRealSense/librealsense.git librealsense-1.12.1 C:\> cd librealsense-1.12.1 C:\> git checkout tags/v1.12.1
C:\workspace\librealsense-1.12.1
folder.2. Configure librealsense 1.12.1
C:/workspace/librealsense-1.12.1/build-vc14
: CMAKE_INSTALL_PREFIX
var to C:/workspace/librealsense-1.12.1/build-vc14
folder location. 3. Install librealsense 1.12.1
C:/workspace/librealsense-1.12.1/Realsense.sln
solution file. This action will open Realsense project in Visual Studio C++ 14 2015.Release
configuration and build INSTALL
target C:/workspace/librealsense-1.12.1/build-vc14/bin/realsense.dll
4. Complete librealsense 1.12.1 installation
REALSENSE_DIR
environment variable: I you have a PointGrey 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
2. Build zbar
C:\workspace\ZBarWin64\zbar64.sln
solution file with Visual Studio C++3. Complete zbar installation
ZBAR_DIR
environment variable: Even if eigen is designed as a template we recommand to install the library with Visual Studio.
1. Get eigen
eigen-eigen-5a0156e40feb.tar.gz
tarball corresponding to eigen 3.3.4.C:\workspace
.C:\workspace\eigen-eigen-5a0156e40feb
in C:\workspace\eigen-3.3.4
2. Configure eigen
To build eigen from source with Visual C++ 2015 (vc14)
C:/workspace/eigen-3.3.4/build-vc14
folder.CMAKE_INSTALL_PREFIX
var to C:/workspace/eigen-3.3.4/build-vc14/install
folder location. C:/workspace/eigen-3.3.4/build-vc14
folder you have the Visual Studio Eigen3.sln
generated solution file.3. Install eigen
C:/workspace/eigen-3.3.4/build-vc14/Eigen3.sln
solution file. This action will open eigen project in Visual Studio C++ 14 2015.INSTALL
target knowing that "Debug" or "Release" configuration doesn't mather C:/workspace/eigen-3.3.4/build-vc14/install
4. Complete eigen installation
Now you have to complete eigen installation setting some environment vars:
EIGEN_DIR
environment variable. Start up a cmd
terminal and enter: C:\workspace\eigen-3.3.4\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.
C:\workspace\visp\visp-x.y.z
using for axample WinRAR.C:\workspace\visp\visp-x.y.z
using for axample WinRAR.We suppose now that ViSP source is in C:\workspace\visp\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 C:/workspace/visp/visp-build-vc14
.
C:/workspace/visp/visp-build-vc14
folder.C:/workspace/visp/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.C:/workspace/visp/visp-build-vc14
folder you have the Visual Studio VISP.sln
generated solution file.C:/workspace/visp/visp-build-vc14/VISP.sln
solution file. This action will open ViSP project in Visual Studio C++. As shown in the next image, by default, Visual Studio position the solution configuration to Debug
. C:/workspace/visp/visp-build-vc14/install
folder; headers and libraries in include
and x64/vc14
subfolders respectively.Debug
configuration.Release
settings. As shown in the next image, select the Release
configuration. C:/workspace/visp/visp-build-vc14/install/x64/vc14/bin
folder you have two versions of ViSP DLL libraries corresponding to ViSP modules; the one suffixed by "d" with debug information, the other one optimized with release compiler options. If you built static libraries then you are done. Otherwise, if you follow this tutorial step by step you need to add the bin folders path to the systems path. This is because you will use ViSP and OpenCV libraries in form of "Dynamic-link libraries" (also known as DLL). Inside these are stored all the algorithms and information the libraries contains. The operating system will load them only on demand, during runtime. However, to do this he needs to know where they are. The systems PATH
variable contains a list of folders where DLLs can be found. Add ViSP and OpenCV libraries path to this and the OS will know where to look if he ever needs the libraries. Otherwise, you will need to copy the used DLLs right beside the applications executable file (exe) for the OS to find it.
To modify the PATH var and add the path to ViSP library, open a cmd
terminal and run:
Then to add the path to OpenCV 3rd party libraries location, close and re-open a cmd-terminal and run:
Then to add the path to libxml2 3rd party library location, close and re-open a cmd-terminal and run:
Then to add the path to librealsense 3rd party library location, close and re-open a cmd-terminal and run:
Then to add the path to zbar 3rd party library location, close and re-open a cmd-terminal and run:
Then close and re-open a cmd terminal to check if the PATH var was well positioned.
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 https://visp.inria.fr/download page. We provide here after the way to install these data if you want to run ViSP examples.
Download visp-images-3.1.0.zip
from https://visp.inria.fr/download and uncompress it in your workspace C:/workspace
.
ViSP examples and tests are able to detect automatically the location of the requested data if you position an environment variable called VISP_INPUT_IMAGE_PATH
. In our case, this variable should be set to C:\workspace\visp-images-3.1.0
.
From now, you can try to run ViSP examples and tests. For example, if you want to run C:/worspace/visp/visp-build-vc14/example/device/display/Debug/displayGDI.exe
, open a command window, 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
terminal, enter in the corresponding Visual Studio folder and run vcvarsall.bat
:
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.