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.3.2 and Visual Studio 2012 but should work with any other version as well.

If you want to use Visual Studio Express, you have to install Express 2013 for Windows Desktop. The Desktop version is important to work with CMake.

CMake 2.8.3 or higher that could be download at : http://www.cmake.org. To install CMake, download the latest binary distribution installer for Windows. You will find it under "Windows (Win32 Installer)". Install CMake just by double clicking on the binary cmake-x.y.z-win32-x86.exe you downloaded.

Install recommended 3rd party

OpenCV 3rd party

We recommend to install OpenCV.

From http://opencv.org/releases.html download the latest OpenCV for Windows version. In our case we install 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.

Note

OpenCV 3.0.0 windows installer contains pre-build libraries compatible with Visual C++ 2013 (in 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.

This will start CMake configuration. As shown in the next image, GDI (Graphical Device Interface), OpenCV and OpenMP 3rd parties are automatically detected.

As given in the previous image, note also that the installation folder is set to C:\ViSP\visp-build\install.

Warning

If you want to change the installation forder to C:/ProgramFiles(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.

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.

To finish the configuration, click on "Generate" button.

Once the generation is done, in C:/ViSP/visp-build folder you have the Visual Studio VISP.sln generated solution file.

Building ViSP from source

To build ViSP just double click on 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.

Enter menu "BUILD/Build Solution" to build ViSP.

At the end of the build process you should have the following indicating that all the build succeeded.

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.

At the end of the installation, you should have the following.

As shown in the previous image, all the headers but also the generated library are copied in C:/ViSP/visp-build/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.

Now, as previously, build and install ViSP again.

At the end, in C:/ViSP/visp-build/install/bin folder you have two versions of ViSP DLL libraries for each module; the one suffixed by "d" with debug information, the other one optimized with release compiler options.

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:\> echo %PATH%

C:\> setx PATH "%PATH%;C:\ViSP\visp-build\install\x64\vc11\bin"

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

C:\> echo %PATH%

C:\> setx PATH "%PATH%;C:\OpenCV\opencv\build\x64\vc11\bin"

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

C:\> echo %PATH%

Install ViSP dataset

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.

We suppose now that the data are located in C:/ViSP/visp-images-3.1.0.

C:\> dir ViSP/visp-images-3.1.0

AprilTag LICENSE.txt calibration cube ellipse-1 line mbt-depth mire-2

Klimt README.md circle ellipse iv mbt mire video

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-images-3.1.0.

C:\> setx VISP_INPUT_IMAGE_PATH C:\ViSP\visp-images-3.1.0

From now, you can try to run ViSP examples and tests. For example, if you want to run C:/ViSP/ViSP-build/example/device/display/Debug/displayGDI.exe, open a command window, enter in the right folder, and run: