1.查看ubuntu内核:uname -r
支持的内核有: supported kernel version (4.[4,8,10,13,15,16]]
2.查看cmake版本:cmake -v
据说要升级到3.6以上,但我的是3.5,暂时没升级。
1.下载source code
git clone https://github.com/IntelRealSense/librealsense.git
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade /我只用了第一个命令
sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev
对应ubuntu16安装的包:
sudo apt-get install libglfw3-dev
./scripts/setup_udev_rules.sh
./scripts/patch-realsense-ubuntu-lts.sh
# ubuntu with kernel4.16的用下面的
./scripts/patch-ubuntu-kernel-4.16.sh
这里需要等待的时间较长
echo 'hid_sensor_custom' | sudo tee -a /etc/modules
3、编译librealsense2 SDK
以下命令默认产生核心共享对象以及debug模式的unit-test二进制文件,如果要产生release版本的,后面加上-DCMAKE_BUILD_TYPE=Release
dd librealsense
mkdir build && cd build
cmake ..
下面两个指令可根据考虑实际情况跳过:
cmake ../ -DBUILD_EXAMPLES=true - Builds librealsense along with the demos and tutorials
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false - For systems without OpenGL or X11 build only textual examples
sudo make uninstall && make clean && make && sudo make install
共享对象将安装在 /usr/local/lib,头文件在/usr/local/include。
demos, tutorials 和test files 将被复制到/usr/local/bin
参考1
1.Register the server’s public key:
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
2、将server加入仓库列表
sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main" -u
3、更新
更新局部包:
sudo apt-get update
更新所有安装的包,包括librealsense:
sudo apt-get upgrade
更新选定的包:
sudo apt-get --only-upgrade install <package1 package2 ...>
4、安装演示demo和tool库
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
5、(可选)安装开发和debug包
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
安装了librealsense2-dev,我们可以使用g++ -std=c++11 filename.cpp -lrealsense2或者IDE编译使用librealsense库的应用。