Visual Servoing Platform
version 3.0.1
|
In this tutorial you will learn how to install ViSP from source on Windows 8.1 with Visual C++. These steps have been tested on Windows 8.1 (64 bit), with CMake 3.3.2 and Visual Studio Express 2013 but should work with any other version as well.
ViSP is interfaced with several 3rd party libraries. The complete list is provided here.
We recommend to install the following:
We recommend to install the "Windows Software Development Kit (SDK) for windows 8.1" to get the Graphical Device Interface (GDI) capabilities. The GDI is used in ViSP to display images in a window thanks to vpDisplayGDI class.
We recommend also to install OpenCV.
opencv-3.0.0.exe
pre-build SDK in C:\OpenCV
. The installer opencv-3.0.0.exe extracted all the material in C:\OpenCV\opencv
. C:\OpenCV\opencv\build\x86\vc12
and in C:\OpenCV\opencv\build\x64\vc12
for the Win64 compiler) and also libraries compatible with Visual C++ 2012 (in C:\OpenCV\opencv\build\x86\vc11
and in C:\OpenCV\opencv\build\x64\vc11
for the Win64 compiler). With any other compiler version you need to build yourself OpenCV from source.OpenCV_DIR
environment variable. Start up a command window (in your "Start" menu click on "Run" and type in cmd.exe
) and enter: C:\OpenCV\opencv\build
is where you have the build directory (extracted or built). Inside this folder you should have a file named OpenCVConfig.cmake
.We give also the way to install other 3rd party libraries to enable specific capabilities.
If you are interested in augmented reality (see vpAROgre), or if you want to enable advanced visibility computation during model-based tracking (see vpMbTracker::setOgreVisibilityTest() and Tutorial: Markerless model-based tracking) we recommend to install Ogre3D. You can check if a prebuild SDK matches your Visual C++ version, and follow the SDK installation instructions. You can also install the lastest release from source. Based on our experience, this is what we recommend.
Ogre source code is hosted on BitBucket. On Ogre wiki you will find useful information to build and install Ogre from source. Hereafter we give the main steps.
Ogre prerequisities
Getting Ogre dependencies
C:\Ogre\ogredeps
as in the next image: C:\Ogre\ogredeps
Building Ogre dependencies
C:\Ogre\ogredeps
and build location pointing to C:\Ogre\ogredeps\build
. Select Visual Studio 12 2013 Win64 as generator, click on "Configure" button twice and then on "Generate" button. You should have something similar to the next image: C:\Ogre\ogredeps\build\OGREDEPS.sln
solution file with Visual C++.DXSDK_DIR
that is not set, see Unable to build ogredeps: DXSDK_DIR missing for a work arround.C:\Ogre\ogredeps\build\ogredeps\bin
you will find the Cg and OIS dependencies build in Debug and Release: OGRE_DEPENDENCIES_DIR
environment variable pointing to C:\Ogre\ogredeps\build\ogredeps
Getting Ogre source
C:\Ogre\ogre
and select revision v1-9 corresponding to the branch of the latest release as presented in the next image: C:\Ogre\ogre
Building Ogre source
C:\Ogre\ogre
and build location pointing to C:\Ogre\ogre\build
. Select Visual Studio 12 2013 Win64 as generator, click on "Configure" button and then on "Generate" button. You should have something similar to the next image: C:\Ogre\ogre\build\sdk
.C:\Ogre\ogre\build\OGRE.sln
solution file with Visual C++.C:\Ogre\ogre\build\sdk\bin
you will find all the libraries in Debug and Release configuration, including Cg and OIS dependencies there where build previously. C:\Ogre\ogre\build\sdk
location. There are different ways to get ViSP source code.
We suppose now that ViSP source is in a directory denoted <source_dir>
, for example C:\ViSP\visp
The goal of the configuration step is now to use CMake to produce a Visual Studio C++ solution that will be located in <binary_dir>
, for example C:\ViSP\visp-build
.
<source_dir>
and <binary_dir>
locations as in the next image.C:\ViSP\visp-build
folder.C:\ViSP\visp-build\install
. C:/Program
Files
(x86)/ViSP, make sure that you have administrator privileges to write in that folder.
.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:/ViSP/visp-build
folder you have the Visual Studio VISP.sln
generated solution file.C:/ViSP/visp-build/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:/ViSP/visp-build/install
folder.Debug
configuration.Release
settings. As shown in the next image, select the Release
configuration.C:/ViSP/visp-build/install/x64/vc12/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:
If installed, you have also to add the location of Ogre 3rd party libraries to the path. Close and re-open a cmd terminal to 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 http://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-x.y.z.zip from http://visp.inria.fr/download and uncompress it for example in C:/ViSP
.
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:\ViSP
.
VISP_INPUT_IMAGE_PATH
should not contain the folder ViSP-images
, but the parent folder.From now, you can try to run ViSP examples and tests. For example, if you want to run <binary
dir>/example/device/display/Debug/displayGDI.exe, open a command window, enter in the right folder, and run:
During ogredeps build as described in Ogre3D 3rd party installation you may get in Visual C++ the following error when building SDL2 project:
To fix the issue:
OGREDEPS_BUILD_SDL2
option off C:\Ogre\ogredeps\build\OGREDEPS.sln
solution file with Visual C++ and try a new build as described in Ogre3D 3rd partyIf you run mbtEdgeTracking.exe
, mbtKltTracking.exe
or mbtEdgeKltTracking.exe
enabling Ogre visibility check (using "-o" option), you may encounter the following issue:
and then a wonderful runtime issue as in the next image:
It means maybe that Ogre version is not compatible with DirectX 11. This can be checked adding "-w" option to the command line:
Now the binary should open the Ogre configuration window where you have to select "OpenGL Rendering Subsystem" instead of "Direct3D11 Rendering Subsystem". Press then OK to continue and start the tracking of the cube.
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.