![]() |
Visual Servoing Platform version 3.7.0
|
In this tutorial you will learn how to install ViSP from source on CentOS. These steps have been tested with CentOS 8.1 (x86_64), but should work with any other distribution as well.
Prior to build and install ViSP from source, you may install GNU g++ compiler, CMake and git. This can be achieved running:
$ sudo yum install gcc-c++ make cmake git wget
First create a workspace that will contain all ViSP source, build, data set and optional 3rd parties. This workspace is here set to $HOME/visp-ws folder, but it could be set to any other location.
In a terminal, run:
$ echo "export VISP_WS=$HOME/visp-ws" >> ~/.bashrc $ source ~/.bashrc $ mkdir -p $VISP_WS
In this section, we give minimal instructions to build ViSP from source just to try ViSP without entering in 4. Advanced ViSP installation.
$ sudo yum install opencv-devel libX11-devel lapack-devel libv4l-devel libjpeg-devel libpng-devel json-devel
$ cd $VISP_WS $ git clone https://github.com/lagadic/visp.git
$ mkdir -p $VISP_WS/visp-build $ cd $VISP_WS/visp-build $ cmake ../visp $ make -j4
$ echo "export VISP_DIR=$VISP_WS/visp-build" >> ~/.bashrc $ source ~/.bashrc
To have a trial, just jump to 5. Install ViSP dataset before running some binaries that you just build or jump to 8. Next tutorial. You can later come back to the 4. Advanced ViSP installation.
ViSP is interfaced with several 3rd party libraries. Follow the link to see the complete list of Supported Third-Party Libraries.
We recommend to install the following:
Installation of recommended 3rd parties could be performed running:
$ sudo yum install opencv-devel libX11-devel lapack-devel eigen3-devel libv4l-devel json-devel
We give also the way to install other 3rd party libraries to enable specific capabilities.
$ sudo yum install libjpeg-devel libpng-devel
There are different ways to get ViSP source code:
$ tar xvzf visp-x.y.z.tar.gz -C $VISP_WSor
$ unzip visp-x.y.z.zip -d $VISP_WS
$ tar xvzf visp-snapshot-yyyy-mm-dd.tar.gz -C $VISP_WS
$ cd $VISP_WS $ git clone https://github.com/lagadic/visp.git
We suppose now that ViSP source is in the directory $VISP_WS/visp. The following should be adapted if you downloaded ViSP from a zip or tarball. In that case, the source is rather in something like $VISP_WS/visp-x.y.z.
These are the steps to configure ViSP from source with CMake:
$ mkdir $VISP_WS/visp-build
$ cd $VISP_WS/visp-build $ cmake ../vispA more versatile way to configure the build is to use ccmake, the CMake GUI:
$ ccmake ../vispThe following image shows that this command allows to configure (just by pressing [c] key) the build in a more advanced way where some options could be easily turned ON/OFF. It allows also to see which are the 3rd parties that will be used. To generate the makefiles, just press [g] key in the ccmake gui.
To build ViSP libraries proceed with:
$ cd $VISP_WS/visp-build $ make -j4
To build ViSP documentation, you have first to install Doxygen package:
$ sudo yum install doxygen graphviz
Then you can proceed with:
$ cd $VISP_WS/visp-build $ cmake ../visp $ make -j4 visp_doc
The generated documentation is then available in $VISP_WS/visp-build/doc/html/index.html
$ npm install mathjax $ cmake ../visp -DUSE_MATHJAX=ON $ make -j4 visp_doc
$ cmake ../visp -DENABLE_FULL_DOC=ON $ make -j4 visp_doc
In order to ease ViSP detection by CMake when ViSP is used as a 3rd party in an external project, like the one described in the Tutorial: How to create and build a project that uses ViSP and CMake on Unix or Windows, you may set VISP_DIR environment variable with the path to the VISPConfig.cmake file:
$ echo "export VISP_DIR=$VISP_WS/visp-build" >> ~/.bashrc $ source ~/.bashrc
Some ViSP examples and tests require a data set that contains images, video, models that is not part of ViSP source code. This data set is available in Github (https://github.com/lagadic/visp-images) or as a release in a separate archive named visp-images-x.y.z.zip. This archive could be downloaded from https://visp.inria.fr/download page. Note that ViSP tutorials are not using ViSP data set.
We give hereafter the two ways to get this data set:
$ unzip ~/Downloads/visp-images-3.6.0.zip -d $VISP_WS
$ ls $VISP_WS/visp-images-3.6.0 3dmodel README.md ellipse mbt video AprilTag Solvay ellipse-1 mbt-cao warp Bayer calibration endianness mbt-depth xml Gaussian-filter circle faces memorial Klimt cube iv mire LICENSE.txt dnn line mire-2
$ echo "export VISP_INPUT_IMAGE_PATH=$VISP_WS/visp-images-3.6.0" >> ~/.bashrc $ source ~/.bashrc
C:\> cd $VISP_WS C:\> git clone https://github.com/lagadic/visp-images.git
$ echo "export VISP_INPUT_IMAGE_PATH=$VISP_WS/visp-images" >> ~/.bashrc $ source ~/.bashrc
$ cd $VISP_WS/visp-build $ ./example/device/display/displayX A click to close the windows... A click to display a cross... Cross position: 201, 441 A click to exit the program... Bye
Since all 3rd parties are optional you may have started to install only some of them. Imagine that you just installed a new third-party, or that you upgraded the version of this 3rd party. The next step is to go back to the build folder, configure ViSP with CMake to detect the newly installed third-party library and build again ViSP. This could be achieved with:
$ cd $VISP_WS/visp-build $ cmake ../visp
Here you can check the content of the ViSP-third-party.txt file and see if the newly installed 3rd party is well detected (see 6.7. Which are the 3rd party libraries that are used in ViSP?).
Finally, you need to rebuild ViSP with:
$ make -j4
Installing ViSP is optional and not recommended, since ViSP could be used as a 3rd party without installation. If you still want to proceed with the installation run:
$ cd $VISP_WS/visp-build $ sudo make install
$ cd $VISP_WS/visp-build $ cmake ../visp -DCMAKE_INSTALL_PREFIX=/usr $ make -j4 $ sudo make install
$ cd $VISP_WS/visp-build $ cmake ../visp -DCMAKE_INSTALL_PREFIX=/my/install/folder $ make -j4 $ sudo make install $ echo "export VISP_DIR=/my/install/folder/lib/cmake/visp" >> ~/.bashrc $ source ~/.bashrc
After ViSP installation, you can remove installed material using:
$ cd $VISP_WS/visp-build $ sudo make uninstall
If you want to build only ViSP modules libraries, nor the examples, tutorials and tests:
$ make -j4 visp_modules
If you want to build a given module and all the dependencies:
$ cd $VISP_WS/visp-build $ make -j4 visp_<module_name>
For example to build the model-based tracker module named mbt, run:
$ make -j4 visp_mbt
To know which are the target available with make:
$ make help | grep visp ... visp_tutorials ... visp_tests ... visp_modules ... visp_doc ... visp_examples ... visp_demos ... visp_clipper ... visp_apriltag ... visp_core ... visp_gui ... visp_imgproc ... visp_io ... gen_visp_java_source ... visp_klt ... visp_me ... visp_sensor ... visp_ar ... visp_blob ... visp_robot ... visp_visual_features ... visp_vs ... visp_vision ... visp_detection ... visp_mbt ... visp_tt ... visp_tt_mi
To see which are the optional 3rd parties that are found during the configuration stage and that will be used by ViSP during the build you can have a look to the text file named ViSP-third-party.txt and located in $VISP_WS/visp-build. We provide hereafter an example of a possible content of this file:
CMake Warning at src/CMakeLists.txt:80 (add_library):
Cannot generate a safe runtime search path for target visp because files in
some directories may conflict with libraries in implicit directories:
runtime library [libpthread.so] in /usr/lib64 may be hidden by files in:
//lib64
Some of these libraries may not be found correctly.
$ ls -als //lib64 0 lrwxrwxrwx. 1 root root 9 Feb 4 12:16 //lib64 -> usr/lib64 $ ls -als //lib64/libpthread* 140 -rwxr-xr-x. 1 root root 141616 Jan 27 15:13 //lib64/libpthread-2.17.so 4 -rw-r--r--. 1 root root 222 Jan 27 14:42 //lib64/libpthread.so 0 lrwxrwxrwx. 1 root root 18 Feb 4 12:34 //lib64/libpthread.so.0 -> libpthread-2.17.so
$ cd //lib64 $ sudo rm libpthread.so $ sudo ln -s libpthread-2.17.so libpthread.so $ ls -als libpthread* 140 -rwxr-xr-x. 1 root root 141616 Jan 27 15:13 libpthread-2.17.so 0 lrwxrwxrwx. 1 root root 18 Feb 4 16:09 libpthread.so -> libpthread-2.17.so 0 lrwxrwxrwx. 1 root root 18 Feb 4 12:34 libpthread.so.0 -> libpthread-2.17.so
$ ./example/video/videoReader
You are now ready to see the next Tutorial: How to create and build a project that uses ViSP and CMake on Unix or Windows that will show you how to use ViSP as a 3rd party to build your own project.