参考链接:https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md
该博客只针对于ubuntu16.04-LTS,14.*或者18.*的系统请参考上面的链接。
Prerequisites:
1.更新ubuntu系统和稳定版本的内核
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
2.下载或者克隆librealsense的源码 (以下二者方式选择其一)
- Download the complete source tree with git
git clone https://github.com/IntelRealSense/librealsense.git
- Download and unzip the latest stable version from
master
branch:
https://github.com/IntelRealSense/librealsense/archive/master.zip
3.准备Linux后端和开发环境:
-
导航到librealsense根目录以运行以下脚本。拔下所有连接的Intel RealSense摄像头。
-
安装依赖的package
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
sudo apt-get install libglfw3-dev
-
安装CMake版本大于3.8.可以从https://cmake.org/download/下载安装。
4.运行位于librealsense根目录的英特尔realsense权限脚本:
./scripts/setup_udev_rules.sh
5.构建并应用修补的内核模块( Ubuntu 14/16/18 with LTS kernel):(这一步最好不要执行)
./scripts/patch-realsense-ubuntu-lts.sh
Building librealsense2 SDK:
1.进入到 librealsense 根目录,运行如下:
mkdir build && cd build
2.运行cmake
cmake ../
The default build is set to produce the core shared object and unit-tests binaries in Debug mode.
Use -DCMAKE_BUILD_TYPE=Release
to build with optimizations.
Use-DBUILD_EXAMPLES=true
- Builds librealsense along with the demos and tutorials
Use -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false For systems without OpenGL or X11 build only textual examples
3.重新编译和安装 librealsense 二进制文件
sudo make uninstall && make clean && make && sudo make install
The shared object will be installed in /usr/local/lib
, header files in /usr/local/include
. The binary demos, tutorials and test files will be copied into /usr/local/bin