ViSP  2.10.0
Tutorial: Installation from source on Windows 7 with Visual C++ 2012

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

Note
Concerning ViSP installation, we provide also other Tutorials.

Required packages

Getting ViSP source code

There are different ways to get ViSP source code.

Getting the latest release

You can download the latest stable release as a zip.

Getting the latest snapshot

When significant changes or bug fixes were introduced in the current developpement version of the source code, we provide snapshots.

If available, you can download a recent snapshot following the link.

Getting the source from Subversion

You can also get the cutting-edge ViSP version from Subversion repository svn://scm.gforge.inria.fr/svn/visp/trunk/ViSP.

One way to do that under Windows is to install Subversion that comes with Cygwin installer that is available on https://cygwin.com/install.html

  • From the previous link, download Cygwin installer for 32-bits or 64-bits version.
  • Double click on the setup binary to start installation. Keep the default settings and select a mirror.
  • As shown in the next image, in the window that allows to select the packages, search for "subversion" and select "subversion" package in "Devel":
    img-win8.1-cygwin-svn.jpg
  • Click on Next button twice to start installation, and then on Finish button to exit installer.
  • Now you should be able to use subversion
    C:\Users\...> C:\cygwin64\bin\svn.exe --version
    svn, version 1.7.14

Once installed, to get ViSP source code run:

C:\Users\...> cd C:\ViSP
C:\Users\...> C:\cygwin64\bin\svn.exe checkout svn://scm.gforge.inria.fr/svn/visp/trunk/ViSP ViSP-code

Configuring ViSP from source

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

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

  • Launch CMake (cmake-gui) and complete the <source_dir> and <binary_dir> locations as in the next image.
img-cmake-win7-msvc-launch.jpg
  • Click then on "Configure" button.
img-cmake-win7-create-build-folder.jpg
  • Click on "Yes" to create the C:\ViSP\ViSP-2.10.0-build folder.
  • Select then your compiler, for example here Visual Studio 11 Win64, and click on "Finish" button.
img-cmake-win7-msvc-version.jpg
  • This will start CMake configuration. As shown in the next image, GDI (Graphical Device Interface) and OpenMP 3rd parties are automatically detected.
img-cmake-win7-msvc-config.jpg
  • As given in the previous image, note also that the installation folder is set to C:\ViSP\ViSP-2.10.0-build\install.
    Warning
    If you want to change the installation forder to C:/Program Files (x86)/ViSP, make sure that you have administrator privileges to write in that folder.
  • Click then on "Configure" button. All the red lines should disappear.
    img-cmake-win7-msvc-config-end.jpg
    Note
    The default configuration lead to the creation of a shared library (with .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.

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. From http://opencv.org/downloads.html download the latest OpenCV for Windows version. There is an OpenCV tutorial: Installation Using the Pre-build Libraries that may help. In our case we install OpenCV-3.0.0-beta.exe pre-build SDK in C:\OpenCV. The installer opencv-3.0.0-beta.exe 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-3.0.0-beta\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-win7-opencv.jpg
  • As shown in the next image, if you enable the advanced 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.

Ending the configuration

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

Building ViSP from source

  • To build ViSP just double click on C:/ViSP/ViSP-2.10.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-win7-msvc-open.jpg
  • Enter menu "BUILD/Build Solution" to build ViSP.
img-win7-msvc-build.jpg
  • At the end of the build process you should have the following indicating that all the build succeeded.
img-win7-msvc-build-succeed.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-win7-msvc-install.jpg
  • At the end of the installation, you should have the following.
img-win7-msvc-install-succeed.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-win7-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-win7-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 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:

C:\Users\...> echo %PATH%
C:\Users\...> setx PATH "%PATH%;C:\ViSP\ViSP-2.10.0-build\install\x64\vc12\bin"

Then to add the path to OpenCV 3rd party libraries, close and re-open a cmd-terminal and run:

C:\Users\...> echo %PATH%
C:\Users\...> setx PATH "%PATH%;C:\OpenCV\opencv\build\x64\vc12\bin"

Then close and re-open a cmd terminal to check if the PATH var was well positioned

C:\Users\...> echo %PATH%

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-win7-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-win7-cmd-displayGDI.jpg

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.