第一次安装realsense2及使用pyrealsense2时费了好大功夫,因为好多文档中都有坑,有的又是跳着写的,参考了几篇文档最后又参考官网上总算成功安装上librealsense2,其实英文比较好的同学可以直接参考官方文档,pyrealsense2我安装的时候是12月15号,中文文档反正我是没怎么见到,我去国外论坛及官方文档一看,12月1号才发布pyrealsense2,根据参考也调试成功,并能成功运行demo,最近换了主机又要重新搭环境,到后面又要安装realsense,特此记录一下
https://realsense.intel.com/sdk-2/#install
https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md
SDK2.0(2.17.0)版本下载链接:
https://github.com/IntelRealSense/librealsense/releases/tag/v2.17.0
Register the server's public key:sudo apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE
In case the public key still cannot be retrieved, check and specify proxy settings: export http_proxy="http://
, and rerun the command. See additional methods in the following link.
Add the server to the list of repositories:
Ubuntu 16 LTS:sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main" -u
Ubuntu 18 LTS:sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u
Install the libraries (see section below if upgrading packages):sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
The above two lines will deploy librealsense2 udev rules, build and activate kernel modules, runtime library and executable demos and tools.
Optionally install the developer and debug packages:sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
With dev
package installed, you can compile an application with librealsense using g++ -std=c++11 filename.cpp -lrealsense2
or an IDE of your choice.
Reconnect the Intel RealSense depth camera and run: realsense-viewer
to verify the installation.
Verify that the kernel is updated :modinfo uvcvideo | grep "version:"
should include realsense
string
Important Removing Debian package is allowed only when no other installed packages directly refer to it. For example removing librealsense2-udev-rules
requires librealsense2
to be removed first.
Remove a single package with:sudo apt-get --purge
Remove all RealSense™ SDK-related packages with:dpkg -l | grep "realsense" | cut -d " " -f 3 | xargs sudo dpkg --purge
接着就是更新固件:
https://www.intel.com/content/dam/support/us/en/documents/emerging-technologies/intel-realsense-technology/Linux-RealSense-D400-DFU-Guide.pdf
第8、9页按步来即可,我还整理了中文的可参考此专栏固件升级https://blog.csdn.net/qq_42393859/article/details/86133988
若之前没成功显示图像,这次在执行realsense-viewer即可,若要进行开发,还需继续
1)下载cmake-3.8.2.tar.gz : https://cmake.org/files/
or https://blog.csdn.net/qq_42393859/article/details/85251356
2) 在主文件夹下新建tools/文件夹,将cmake-3.8.2.tar.gz解压之后放在tools/中,为了防止出现权限不足问题,直接对文件更改权限:
解压:sudo tar -zxvf cmake-3.8.2.tar.gz
赋权限:sudo chmod -R 777 cmake-3.8.2
3)a安装gcc-c++:
sudo apt-get install build-essential
或者直接执行这两条命令
sudo apt-get install gcc
sudo apt-get install g++
4)进入文件夹下执行以下命令:
sudo ./bootstrap
sudo make
sudo make install
5)查看是否安装成功以及安装版本:
cmake --version
Note: USB接口必须为3.0
内核版本>4.4.0
本系统为 Ubuntu 16.04.3,如果安装步骤上有所不同,请参照英文版教程:
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation.md 对应版本安装。
1)先确定内核版本:
uname -r
如果>=4.4.0-50的版本就可以继续向下进行了,否则需要升级你的Ubuntu内核。
2)安装一些依赖:
sudo apt-get install libusb-1.0-0-dev pkg-config libgtk-3-dev
3)安装glfw3库:
sudo apt-get install libglfw3-dev
4)下载驱动安装包:
git clone https://github.com/IntelRealSense/librealsense
5)进入该文件夹
cd librealsense/
6)在 librealsense 文件夹下执行
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
7)进入下载的 librealsense 路径下,执行如下:
$ mkdir build
$ cd build
$ cmake ../
$ cmake ../ -DBUILD_EXAMPLES=true
$ make && sudo make install
8)在 librealsense 文件夹下安装Video4Linux视频内核驱动,注意不要插上RealSense R200摄像头。
在librealsense的路径下执行:
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger
安装Openssl库:
sudo apt-get install libssl-dev
编译配置文件:
./scripts/patch-realsense-ubuntu-xenial.sh
提示完成后,插上RealSense,再执行:
sudo dmesg | tail -n 50
可无失败信息则可验证安装驱动成功。
此时可进入/usr/local/lib中查看或者librealsense下的example文件夹下,执行:
./cpp-capture.cpp
出现RealSense拍摄的图像即成功!
https://blog.csdn.net/qq_42393859/article/details/85044330
因为运行demo和开发里面会用到opencv,你还需安装cv2,在线安装即可,不必编译,太费时间
全都完成后就可以用python开发了
最后附张博主狗头,手动滑稽