Ubuntu14.04安装librealsense(camera R200)

刚开始安装之前,查了很多资料。后来发现还是官网的文档最靠谱。

参考github上`/doc/installation.md`

注意:

现在github上librealsense的master branch是2.0版本的SDK,我的摄像头是R200,推荐安装的应该是1.0版本,在Legacy branch下面。这点需要额外注意,我就是因为没注意读说明,上来就装了mater branch下的2.0,结果打不开我的R200。提了个issue,才知道该装1.0


安装过程:

升级Ubuntu14.04的内核,要确保在4.4.50以上
  • sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
    对于一些低版本内核,上述三个命令不足以保证能将内核成功升级,接着运行:
  • sudo apt-get install --install-recommends linux-generic-lts-xenial xserver-xorg-core-lts-xenial xserver-xorg-lts-xenial xserver-xorg-video-all-lts-xenial xserver-xorg-input-all-lts-xenial libwayland-egl1-mesa-lts-xenial
  • 记住安装的内核的版本,比如这里我安装的是4.4.0-112-generic(在安装2.0版本的时候做过一遍这个步骤,当时升级到了4.4.0-111-generic)
  • 然后重启
    sudo update-grub && sudo reboot
    重启的时候选择高级选项,选4.4.0-112-generic那个启动项
  • 进入系统之后运行
    uname -r
    确认内核的版本
安装依赖项

sudo apt-get install libusb-1.0-0-dev pkg-config
下载legacy分支下的文件,并且解压进入解压后的文件夹目录。` ~/Downloads/librealsense-legacy/`
./scripts/install_glfw3.sh
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/include/GLFW
-- Installing: /usr/local/include/GLFW/glfw3.h
-- Installing: /usr/local/include/GLFW/glfw3native.h
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Config.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3ConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets.cmake
-- Installing: /usr/local/lib/cmake/glfw3/glfw3Targets-noconfig.cmake
-- Installing: /usr/local/lib/pkgconfig/glfw3.pc
-- Installing: /usr/local/lib/libglfw.so.3.2
-- Up-to-date: /usr/local/lib/libglfw.so.3
-- Up-to-date: /usr/local/lib/libglfw.so
Done installing glfw3!
上面的是安装glfw3的结果

编译和安装
  1. mkdir build && cd build

  2. cmake ../
  3. cmake ../ -DBUILD_EXAMPLES=true
  4. make && sudo make install
    
    安装位置:库文件:/usr/local/lib 头文件:/usr/local/include demos, tutorials and tests :/usr/local/bin

安装V4L

sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/
sudo udevadm control --reload-rules && udevadm trigger

sudo apt-get install libssl-dev
# 回到解压缩文件夹目录,运行下面的脚本
# 注意运行这个脚本的时候要拔掉摄像头
./scripts/patch-realsense-ubuntu-xenial.sh
script的运行结果:

Patched kernel module created successfully

Handle uvcvideo :
Module is resident, unloading ...  succeeded. 
Applying the patched module ...  succeeded


Script has completed successfully. Please consult the installation guide for further instruction.


运行下面的命令,检查上面脚本的运行结果

sudo dmesg | tail -n 50
结果如下:

[duyl@ ~/Downloads/librealsense-legacy]14:38$ sudo dmesg | tail -n 50
[ 2181.959700] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2189.735339] systemd-hostnamed[5791]: Warning: nss-myhostname is not installed. Changing the local hostname might make it unresolveable. Please install nss-myhostname!
[ 2286.338849] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 2286.617633] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2286.617656] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2286.902883] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 2287.181013] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2287.181019] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2436.613356] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 2436.891560] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2436.891592] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2437.173328] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 2437.451966] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2437.451989] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2636.552369] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 2636.830929] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2636.830954] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2637.112289] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 2637.391121] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 2637.391144] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3003.917809] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 3004.196396] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3004.196423] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3004.461784] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 3004.740113] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3004.740132] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3095.311287] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 3095.589577] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3095.589604] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3095.847286] usb 1-3.4: reset low-speed USB device number 6 using xhci_hcd
[ 3096.125293] usb 1-3.4: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3096.383295] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 3096.661899] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3096.661926] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3158.971936] usbcore: deregistering interface driver uvcvideo
[ 3159.295591] media: Linux media interface: v0.10
[ 3159.305369] Linux video capture interface: v2.00
[ 3159.313350] uvcvideo: module verification failed: signature and/or required key missing - tainting kernel
[ 3159.313808] uvcvideo: Found UVC 1.00 device Integrated Webcam (1bcf:2c01)
[ 3159.321674] input: Integrated Webcam as /devices/pci0000:00/0000:00:14.0/usb1/1-5/1-5:1.0/input/input21
[ 3159.321970] usbcore: registered new interface driver uvcvideo
[ 3159.321976] USB Video Class driver (1.1.1)
[ 3211.504872] usb 1-3.4: reset low-speed USB device number 6 using xhci_hcd
[ 3211.783042] usb 1-3.4: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3216.913056] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 3217.191717] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3217.191745] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3217.473159] usb 1-3.3: reset low-speed USB device number 4 using xhci_hcd
[ 3217.751717] usb 1-3.3: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
[ 3217.751741] usb 1-3.3: ep 0x82 - rounding interval to 64 microframes, ep desc says 80 microframes
[duyl@ ~/Downloads/librealsense-legacy]14:39$ 
注意倒数第几行显示的: usbcore: registered new interface driver uvcvideo


连接上摄像头,运行/usr/local/bin/目录下的cpp-capture。

[duyl@ /usr/local/bin]14:59$ ./cpp-capture 
Ubuntu14.04安装librealsense(camera R200)_第1张图片
安装成功。


备注:

第一次安装错误了,安成了SDK2.0,后来装1.0,但是没有把2.0先uninstall,还是有点问题。

进入2.0SDK文件夹的build文件夹下面,运行

sudo make uninstall
make clean
把前面的清理掉,然后就行了。

你可能感兴趣的:(Ubuntu)