Visual Servoing Platform
version 3.6.1 under development (2024-11-21)
|
In this tutorial you will learn how to install ViSP from source on Linux Ubuntu. These steps have been tested with Ubuntu 16.04 64bits LTS, 17.04 64bits, 18.04 64bits LTS, 18.10 64bits 20.04 64bits LTS and Debian 9.6.0 64bits distributions, 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 apt-get install build-essential cmake-curses-gui 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 Advanced ViSP installation.
$ sudo apt-get install libopencv-dev libx11-dev liblapack-dev libeigen3-dev libv4l-dev \ libzbar-dev libpthread-stubs0-dev libdc1394-dev nlohmann-json3-dev
$ sudo apt-get install libopencv-dev libx11-dev liblapack-dev libeigen3-dev libv4l-dev \ libzbar-dev libpthread-stubs0-dev libdc1394-22-dev
$ 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 -j$(nproc)
VISP_DIR
environment variable $ echo "export VISP_DIR=$VISP_WS/visp-build" >> ~/.bashrc $ source ~/.bashrc
To have a trial, just jump to Install ViSP data set before running some binaries that you just build or jump to Next tutorial. You can later come back to the Advanced ViSP installation.
ViSP is interfaced with several optional 3rd party libraries. Follow the link to see the complete list of Supported Third-Party Libraries.
We recommend to install the following 3rd parties:
Installation of recommended 3rd parties could be performed running:
$ sudo apt-get install libopencv-dev libx11-dev liblapack-dev libeigen3-dev libv4l-dev libzbar-dev \ libpthread-stubs0-dev libdc1394-dev nlohmann-json3-dev
$ sudo apt-get install libopencv-dev libx11-dev liblapack-dev libeigen3-dev libv4l-dev libzbar-dev \ libpthread-stubs0-dev libdc1394-22-dev
Note that on older distributions, the apt package for the JSON library is outdated. If needed, you may install JSON for modern C++ from source.
If you have an Intel RealSense Depth camera (SR300 or D400 series), you may install librealsense 2.x in order to use vpRealSense2 class. Otherwise you can skip this section.
Installation instructions are given in the tutorial.
Following the tutorial, we recall the main steps here:
librealsense
build: $ sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev cmake-curses-gui $ sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev
librealsense
from github: $ mkdir -p $VISP_WS/3rdparty $ cd $VISP_WS/3rdparty $ git clone https://github.com/IntelRealSense/librealsense.git $ cd librealsense
librealsense
root directory: $ sudo ./scripts/setup_udev_rules.sh
$ mkdir build $ cd build $ cmake .. -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release $ make -j4 $ sudo make install
$ ./examples/capture/rs-capture
If you are able to visualize the images, it means that you succeed in librealsense
installation.
If you have an Occipital Structure Core sensor (monochrome or color), you may install Occipital Structure SDK in order to use vpOccipitalStructure class. Otherwise you can skip this section.
Occipital Structure SDK contains libStructure
pre-built library.
1. To install this SDK
Structure SDK (Cross-Platform)
.StructureSDK-CrossPlatform-0.9
from the downloaded file to the already created directory in $VISP_WS
.The SDK contains pre-built libraries for Linux, Windows and macOS. In order that ViSP detects Structure SDK header files and libraries, you have to set OCCIPITAL_STRUCTURE_DIR
environment variable. Proceed as follows:
$ echo "export OCCIPITAL_STRUCTURE_DIR=$VISP_WS/StructureSDK-CrossPlatform-0.9" >> ~/.bashrc $ source ~/.bashrc
2. Optionally build Occipital Structure SDK samples
As explained in $VISP_WS/StructureSDK-CrossPlatform-0.9/Documentation/linux.html
you can optionally follow these steps to build sample applications provided with the SDK:
$ sudo $OCCIPITAL_STRUCTURE_DIR/DriverAndFirmware/Linux/Install-CoreDriver-Udev-Linux.sh $ cd $OCCIPITAL_STRUCTURE_DIR $ mkdir build $ cd build $ cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .. $ make Samples
After completion, sample apps may be run from the Apps directory.
FlyCapture is the SDK provided by FLIR (previously Point Grey) to work with FLIR USB 2.0, USB 3.0, Gigabit Ethernet or FireWire cameras. If you have such a camera, once FlyCapture is installed you may use vpFlyCapture class. Otherwise you can skip this section.
README
file to install required dependencies (libraw1394-11
, libgtkmm-2.4-dev
, libglademm-2.4-dev
, libgtkglextmm-x11-1.2-dev
, libusb-1.0
). For example, for Ubuntu 18.04 run: $ sudo apt-get install libraw1394-11 libavcodec57 libavformat57 \ libswscale4 libswresample2 libavutil55 libgtkmm-2.4-1v5 \ libglademm-2.4-1v5 libgtkglextmm-x11-1.2-0v5 libgtkmm-2.4-dev \ libglademm-2.4-dev libgtkglextmm-x11-1.2-dev libusb-1.0-0
$ sudo sh install_flycapture.sh
The Pylon Camera Software Suite is a collection of drivers and tools for operating any Basler camera (IEEE1394, Camera Link, GigE or USB3.0 interface). If you don't have a Basler camera you can skip this section.
To install Pylon, visit Basler Software Download page to download and install the SDK corresponding to your platform.
Pylon Camera Software Suite installation enables vpPylonGrabber class usage.
If you have an IDS camera you may install IDS Software Suite for uEye cameras. To this end:
"uEye industrial cameras"
"Firmware"
tab, select "uEye (IDS Software Suite)"
and press "SHOW"
button"Operating system"
tab select "Linux"
or "Linux ARM"
and press the search button"Software package"
section you should see the last "IDS Software Suite"
version you may download. At the time this tutorial was written, we downloaded "IDS Software Suite 4.95 for Linux 64-bit - archive file"
version.Once downloaded, you may unzip the archive
$ unzip ids-software-suite-linux-64-4.95-archive.zip
and proceed to the installation running:
$ sudo sh ./ueye_*.run
$ sudo sh ./ueye_*.run 4.95.0.1134 ... Error: There is an old version of this driver installed. Please uninstall first.you need to uninstall the old version running:
$ sudo /usr/bin/ueyesetup -r allNow, you should be able to proceed to the installation running:
$ sudo sh ./ueye_*.run
Documentation is available in /opt/ids/ueye/manual/en/index.html
.
To test the Sofware Suite installation, plug a camera and run ueyedemo
binary.
$ ueyedemo
$ ueyedemo ueyedemo: error while loading shared libraries: libomp.so.5: cannot open shared object file: No such file or directoryyou may install libomp5 running:
$ sudo apt install libomp5Now you should be able to run
ueyedemo
: $ ueyedemo
IDS uEye Camera Software Suite installation enables vpUeyeGrabber class usage.
I you have a Panda robot from Franka Emika, you may install libfranka in order to use vpRobotFranka class. Otherwise you can skip this section.
Installation instructions are provided following Install Franka library. There is also the Tutorial: PBVS with Panda 7-dof robot from Franka Emika that explains how to install a real-time Linux kernel requested to control the robot by Setting up a real-time kernel.
If you have a Kinova Jaco assistive robotic arm, it could be useful to install the corresponding Gen2 SDK to be able to use vpRobotKinova class. This class is an interface over Kinova Jaco Gen2 SDK and allows to control Gen2 4, 6 and 7 DoF arm.
To install Kinova Jaco SDK:
PS 0000 0009_1.5.1.zip
(254M)./tmp/kinova-jaco
Ubuntu/<version>/64 bits
folder and run the installer: $ cd /tmp/kinova-jaco $ cd Ubuntu/16_04/64 bits $ sh ./installSDK64.sh
/opt/JACO-SDK
If you have an Universal Robots collaborative robot you may install ur_rtde. See how to Install ur_rtde 3rd party instructions to enable vpRobotUniversalRobots class usage.
If you have the Qualisys Motion Capture System you can optionally install qualisys_cpp_sdk from source to enable vpMocapQualisys usage.
$ mkdir -p $VISP_WS/3rdparty/qualisys $ cd $VISP_WS/3rdparty/qualisys $ git clone https://github.com/qualisys/qualisys_cpp_sdk.git $ cd qualisys_cpp_sdk $ mkdir build $ cd build $ cmake .. -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-fPIC $ make -j$(nproc) $ sudo make install
After installation the SDK is available in /usr/local
and will be detected by ViSP if you run a new CMake configuration step over ViSP source code.
If you have the Vicon Motion Capture System you can optionally install Vicon Datastream SDK to enable vpMocapVicon usage.
1. Get Vicon Datastream SDK
ViconDataStreamSDK_1.11.0_128037.zip
.$ mkdir -p $VISP_WS/3rdparty/vicon $ cd $VISP_WS/3rdparty/vicon $ mv ~/Downloads/ViconDataStreamSDK_1.1*.zip . $ unzip ViconDataStreamSDK_1.*.zip $ unzip ViconDataStreamSDK_1.*_Linux64.zip
After installation the SDK is available in $VISP_WS/3rdparty/vicon/Linux64
.
2. Setup for usage
To help ViSP to detect the location of Vicon Datastream SDK you will need to setup the following environment var:
$ export VICON_DIR=$VISP_WS/3rdparty/vicon/Linux64
$ cd $VISP_WS/visp-build $ cmake ../visp -DVICON_DIR=$VISP_WS/3rdparty/vicon/Linux64
3. Known issue
If you encounter the following warning during ViSP cmake configuration:
$ cmake ../visp CMake Warning at cmake/VISPUtils.cmake:790 (add_library): Cannot generate a safe linker search path for target visp_sensor because files in some directories may conflict with libraries in implicit directories: link library [libboost_system.so] in /usr/lib/x86_64-linux-gnu may be hidden by files in: $VISP_WS/3rdparty/vicon/Linux64
it means that boost is installed as a system library and that it has a version that differs from the one that comes with Vicon Datastream SDK that is in $VISP_WS/3rdparty/vicon/Linux64
.
The best to fix this is simply force boost usage from system package by removing the version that comes with the SDK:
$ cd $VISP_WS/3rdparty/vicon/Linux64 $ rm libboost_*.so
and then launch a new ViSP cmake configuration:
$ cd $VISP_WS/visp-build $ cmake ../visp -DVICON_DIR=$VISP_WS/3rdparty/vicon/Linux64
We give also the way to install other 3rd party libraries to enable specific capabilities.
$ sudo apt-get install libpcl-dev
$ sudo apt-get install libcoin-devotherwise use rather:
$ sudo apt-get install libcoin80-dev
$ sudo apt-get install libjpeg-dev libpng-dev
$ sudo apt-get install libogre-1.9-dev libois-dev
$ sudo apt-get install libdmtx-dev
$ sudo apt-get install libgsl-dev
$ sudo apt-get install nlohmann-json3-dev
$ sudo apt-get install libgtk2.0-dev libglib2.0-dev libpango1.0-dev libatk1.0-dev libcairo2-devAfter installing the gtk packages, you need to explicitly enable gtk usage during ViSP cmake configuration step by:
$ cd $VISP_WS/visp-build $ cmake ../visp -DUSE_GTK=ON
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:
visp-build
that will contain all the build material; generated Makefiles, object files, output libraries and binaries. $ mkdir $VISP_WS/visp-build
visp-build
folder and configure the 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 -j$(nproc)
To build ViSP documentation, you have first to install Doxygen package:
$ sudo apt-get install doxygen graphviz texlive-latex-base
Since Ubuntu 22.04, to render Latex formula you need also to install texlive-latex-extra
package:
$ sudo apt install texlive-latex-extra
Then you can proceed with:
$ cd $VISP_WS/visp-build $ cmake ../visp $ make -j$(nproc) 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 -j$(nproc) visp_doc
ENABLE_FULL_DOC
to ON
like: $ cmake ../visp -DENABLE_FULL_DOC=ON $ make -j$(nproc) 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:
1. Get data set release
visp-images-3.6.0.zip
from https://visp.inria.fr/download and uncompress it in your workspace %VISP_WS%
: $ unzip ~/Downloads/visp-images-3.6.0.zip -d $VISP_WS
$VISP_WS/visp-images-3.6.0
. $ 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
VISP_INPUT_IMAGE_PATH
environment variable to help ViSP examples and tests to detect automatically the location of the requested data. In our case, this variable should be set to $VISP_WS/visp-images-3.6.0
. It is more convenient if this environment variables is automatically added to your bash session every time a new shell is launched: $ echo "export VISP_INPUT_IMAGE_PATH=$VISP_WS/visp-images-3.6.0" >> ~/.bashrc $ source ~/.bashrc
2. Get data set from github
C:\> cd $VISP_WS C:\> git clone https://github.com/lagadic/visp-images.git
VISP_INPUT_IMAGE_PATH
environment variable to help ViSP examples and tests to detect automatically the location of the requested data. In our case, this variable should be set to $VISP_WS%/visp-images
. In a shell run: $ echo "export VISP_INPUT_IMAGE_PATH=$VISP_WS/visp-images" >> ~/.bashrc $ source ~/.bashrc
Test data set usage
displayX
example that should open a windows with Klimt painting image and some overlay drawings: $ 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 Which are the 3rd party libraries that are used in ViSP ?).
Finally, you need to rebuild ViSP with:
$ make -j$(nproc)
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
/usr/local
. This location could be changed modifying CMAKE_INSTALL_PREFIX
var: $ cd $VISP_WS/visp-build $ cmake ../visp -DCMAKE_INSTALL_PREFIX=/usr $ make -j$(nproc) $ sudo make install
/usr
or /usr/local
there is no need to Set VISP_DIR environment var that helps CMake to find ViSP libraries in an external project that uses ViSP as a 3rd party. If you rather install ViSP in a non "standard" folder, let say /my/install/folder
, you have to set VISP_DIR
to /my/install/folder/lib/cmake/visp
that contains the VISPConfig.cmake
file: $ cd $VISP_WS/visp-build $ cmake ../visp -DCMAKE_INSTALL_PREFIX=/my/install/folder $ make -j$(nproc) $ 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:
$ cd $VISP_WS/visp-build $ make -j$(nproc) visp_modules
If you want to build a given module and all the dependencies:
$ cd $VISP_WS/visp-build $ make -j$(nproc) visp_<module_name>
For example to build the model-based tracker module named mbt, run:
$ cd $VISP_WS/visp-build $ make -j$(nproc) visp_mbt
To know which are the target available with make
:
$ make help | grep visp ... visp_doc ... visp_examples ... visp_tests ... visp_modules ... visp_demos ... visp_tutorials ... visp_clipper ... visp_apriltag ... visp_qbdevice ... visp_pugixml ... 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 ... visp_java ... visp_java_jar_source_copy ... visp_java_jar
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 that contains also build info.
$ cat $VISP_WS/visp-build/ViSP-third-party.txt ========================================================== General configuration information for ViSP 3.3.1 Version control: 3.2.0-1313-g31602e1f7-dirty Platform: Timestamp: 2020-12-11T12:10:30Z Host: Linux 5.4.0-53-generic x86_64 CMake: 3.16.4 CMake generator: Unix Makefiles CMake build tool: /usr/bin/make Configuration: RelWithDebInfo C/C++: Built as dynamic libs?: yes C++ Compiler: /usr/bin/g++ (ver 7.5.0) C++ flags (Release): -Wall -Wextra -fopenmp -std=c++11 -fvisibility=hidden -mavx -fPIC -O3 -DNDEBUG C++ flags (Debug): -Wall -Wextra -fopenmp -std=c++11 -fvisibility=hidden -mavx -fPIC -g C Compiler: /usr/bin/gcc C flags (Release): -Wall -Wextra -fopenmp -std=c++11 -fvisibility=hidden -mavx -fPIC -O3 -DNDEBUG C flags (Debug): -Wall -Wextra -fopenmp -std=c++11 -fvisibility=hidden -mavx -fPIC -g Linker flags (Release): Linker flags (Debug): ViSP modules: To be built: core gui imgproc io java_bindings_generator klt me sensor ar blob robot visual_features vs vision detection mbt tt tt_mi java Disabled: - Disabled by dependency: - Unavailable: - Python (for build): /usr/bin/python2.7 Java: ant: /usr/bin/ant (ver 1.10.5) JNI: /home/fspindle/visp-ws/java/jdk-11.0.6/include /home/fspindle/visp-ws/java/jdk-11.0.6/include/linux /home/fspindle/visp-ws/java/jdk-11.0.6/include Build options: Build deprecated: yes Build with moment combine: no Mathematics: Blas/Lapack: yes \- Use MKL: no \- Use OpenBLAS: yes (ver 0.2.20) \- Use Atlas: no \- Use Netlib: no \- Use GSL: no \- Use Lapack (built-in): no Use Eigen3: yes (ver 3.3.4) Use OpenCV: yes (ver 3.2.0) Simulator: Ogre simulator: \- Use Ogre3D: yes (ver 1.9.0) \- Use OIS: yes (ver 1.3.0) Coin simulator: \- Use Coin3D: yes (ver 4.0.0) \- Use SoWin: no \- Use SoXt: no \- Use SoQt: no \- Use Qt5: no \- Use Qt4: no \- Use Qt3: no Media I/O: Use JPEG: yes (ver 80) Use PNG: yes (ver 1.6.34) \- Use ZLIB: yes (ver 1.2.11) Use OpenCV: yes (ver 3.2.0) Use stb_image (built-in): no Real robots: Use Afma4: no Use Afma6: no Use Franka: yes (ver 0.7.1) Use Viper650: no Use Viper850: no Use Kinova Jaco: yes Use aria (Pioneer): no Use PTU46: no Use Biclops PTU: no Use Flir PTU SDK: no Use Parrot ARSDK: yes \-Use ffmpeg: yes Use Virtuose: yes Use qbdevice (built-in): yes (ver 2.6.0) Use takktile2 (built-in): yes (ver 1.0.0) GUI: Use X11: yes Use GTK: no Use OpenCV: yes (ver 3.2.0) Use GDI: no Use Direct3D: no Cameras: Use DC1394-2.x: yes (ver 2.2.5) Use CMU 1394: no Use V4L2: yes (ver 1.14.2) Use directshow: no Use OpenCV: yes (ver 3.2.0) Use FLIR Flycapture: yes Use Basler Pylon: no Use IDS uEye: yes (ver 4.93.0) RGB-D sensors: Use Realsense: no Use Realsense2: yes (ver 2.36.0) Use Kinect: no \- Use libfreenect: no \- Use libusb-1: yes (ver 1.0.21) \- Use pthread: yes Use PCL: yes (ver 1.8.1) \- Use VTK: yes (ver 6.3.0) F/T sensors: Use atidaq (built-in): no Use comedi: no Use IIT SDK: no Detection: Use zbar: yes (ver 0.10) Use dmtx: yes (ver 0.7.4) Use AprilTag (built-in): yes (ver 3.1.1) \- Use AprilTag big family: no Misc: Use Clipper (built-in): yes (ver 6.4.2) Use pugixml (built-in): yes (ver 1.9.0) Use libxml2: yes (ver 2.9.4) Optimization: Use OpenMP: yes Use pthread: yes Use pthread (built-in): no Use cxx standard: 11 Documentation: Use doxygen: yes Tests and samples: Use catch2 (built-in): yes (ver 2.9.2) Tests: yes Demos: yes Examples: yes Tutorials: yes Install path: /usr/local ==========================================================
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.