ViSP  2.9.0
Tutorial: Installation from source on Windows

In this tutorial you will learn how to install ViSP from source on Windows. These steps have been tested on Windows 7 (64 bit), with CMake 2.8 and Visual Studio 2012 but should work with any other version as well.

Concerning ViSP installation, we provide also other tutorials

ViSP can also be installed on other platforms OSX, CentOS, openSUZE (see Install from source page).

Required packages

Getting ViSP source code

There are different ways to get ViSP source code:

  • You can download the latest stable release as a zip.
  • You can also download a more recent snapshot.
  • Or you can get the cutting-edge ViSP from Subversion repository svn://scm.gforge.inria.fr/svn/visp/trunk/ViSP.

We suppose now that ViSP source is in a directory denoted <source_dir>, for example C:\ViSP\ViSP-2.9.0

Configuring ViSP from source

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-2.9.0-build.

  • Launch CMake (cmake-gui) and complete the <source_dir> and <binary_dir> locations as in the next image.
img-cmake-win-1.jpg
  • Click then on "Configure" button.
img-cmake-win-2.jpg
  • Click on "Yes" to create the C:\ViSP\ViSP-2.9.0-build folder.
  • Select then your compiler, for example here Visual Studio 11 Win64, and click on "Finish" button.
img-cmake-win-msvc-version.jpg
  • This will start CMake configuration. As shown in the next image, GDI (Graphical Device Interface) and OpenMP 3rd party are automatically detected.
img-cmake-win-4.jpg
  • As given in the previous image, note also that the installation folder is set to C:/Program Files (x86)/ViSP. Make sure that you have administrator privileges to write in that folder. If not and if you want to install ViSP, you have to set an other folder, for example C:/ViSP/ViSP-install.
img-cmake-win-install-prefix.jpg
  • Click then on "Configure" button. All the red lines should disappear.
img-cmake-win-6.jpg
  • Note also that the default configuration lead to the creation of a static library (with .lib extension). It is recommended to rather create a shared library (with .dll extension). As shown in the next image you have to check the BUILD_SHARED_LIBS option to enable DLL creation. Click then on "Configure" button.
img-cmake-win-shared.jpg

Optional 3rd party packages

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

OpenCV 3rd party

  • We recommend to install OpenCV. The simplest is to install OpenCV pre-build libraries by following OpenCV tutorial: Installation Using the Pre-build Libraries. In our case we install OpenCV-2.4.5.exe pre-build SDK in C:\OpenCV. The installer copied all the material in C:\OpenCV\opencv.
  • Now in order that ViSP detects OpenCV you have to set OPENCV_DIR environment variable. Start up a command window (in your "Start" menu click on "Run" and type in cmd.exe) and enter:
    setx OPENCV_DIR C:\OpenCV\opencv\build
  • Here the directory is where you have the build directory (extracted or built). Inside this folder you should have a file named OpenCVConfig.cmake.
  • Quit and restart CMake (cmake gui). It is important to quit CMake in order to take into account the new OPENCV_DIR environment variable. Click "Configure" button. As shown in the next image, a new red line indicating that OpenCV is found should appear.
img-cmake-win-opencv.jpg
  • As shown in the next image, if you enable the advance view, you can see that we will use OpenCV libraries located in C:/OpenCV/opencv/build/x64/vc11/lib folder.
img-cmake-win-opencv-advanced.jpg
  • Press "Configure" button again.

Ogre3D 3rd party

  • We recommend also to install Ogre3D. As given in ViSP third party pages, follow the steps described on Ogre Wiki. In our case we install DirectX SDK (June 2010) and the latest Ogre SDK; OGRE 1.9 RC 1 SDK for Visual C++ .Net 2012 (64-bit) in C:/ViSP/OgreSDK. You should adapt the versions that match your environment.
  • After Ogre3D installation you should get something similar to the next snapshot where Ogre3D SDK is installed in C:/ViSP/OgreSDK/OgreSDK_vc11_x64_v1-9-0unstable.
    img-win-ogre-dir.jpg
  • To help CMake detection of Ogre3D, set the following environment variables (OGRE_HOME and BOOST_ROOT) by opening a Window Command Shell. In our case it becomes:
    img-win-ogre-var.jpg
  • Set also the PATH environment variable to append the location of Ogre3D libraries used during execution. In our case we add C:/ViSP/OgreSDK/OgreSDK_vc11_x64_v1-9-0unstable/bin/Debug and C:/ViSP/OgreSDK/OgreSDK_vc11_x64_v1-9-0unstable/bin/Release.
  • Now quit and restart CMake to take into account the environment variables changes. Select "Configure" button. Ogre3D should be detected.
img-cmake-win-ogre-found.jpg
  • If you enter in the advanced view, you should have something similar to:
img-cmake-win-ogre-found-advanced.jpg
  • Make sure that Boost_, OGRE_ and DIRECT3D_ prefixed vars are well set.
  • Press "Configure" button again.

Ending the configuration

  • To finish the configuration, click on "Generate" button.
img-cmake-win-generate.jpg
  • Once the generation is done, in C:/ViSP/ViSP-2.9.0-build folder you have the Visual Studio VISP.sln generated solution file.
img-cmake-win-solution.jpg

Building ViSP from source

  • To build ViSP just double click on C:/ViSP/ViSP-2.9.0-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.
img-msvc-1.jpg
  • Enter menu "BUILD/Build Solution" to build ViSP.
img-msvc-build.jpg
  • At the end of the build process you should have the following indicating that all the build succeeded.
img-msvc-2.jpg
  • Now to install ViSP, build "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.
img-msvc-install.jpg
  • At the end of the installation, you should have the following.
img-msvc-4.jpg
  • As shown in the previous image, all the headers but also the generated library are copied in C:/ViSP/ViSP-install folder.
  • This ends ViSP installation with Debug configuration.
  • We recommend now to do the same with Release settings. As shown in the next image, select the Release configuration.
img-msvc-release.jpg
  • Now, as previously, build and install ViSP again.
  • At the end, in C:/ViSP/ViSP-install/bin folder you have two versions of ViSP DLL library; the one suffixed by "d" with debug information, the other one optimized with release compiler options.
img-msvc-install-end.jpg

Setting up PATH variable

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 the 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 the 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.

C:\ViSP\ViSP-install\bin; C:\OpenCV\opencv\build\x64\vc11\bin

Appendix

Installing testing data

Some ViSP examples and tests require data set (images, models). These data set is provided as a compressed zip files.

img-ViSP-images.jpg

Using testing data

  • 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.
    setx VISP_INPUT_IMAGE_PATH C:\ViSP
  • It is also possible to run the examples and tests without positioning VISP_INPUT_IMAGE_PATH by using command line option -i <path to the data set>. If you want to run <binary dir>/example/device/display/Debug/displayGDI.exe, open a command window, enter in the right folder, and run:
    displayGDI.exe -i C:\ViSP
img-cmd-displayGDI.jpg

You are now ready to see the next Tutorial: Getting started that will show you how to use ViSP as a 3rd party to build your own project.