Intel realSense ubuntu 16.04+python 环境配置指南

1. 安装librealsense2-dkms 以及librealsense2-utils

1、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://<proxy>:<port>"
, and rerun the command. See additional methods in the following link.)

2、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

3、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.

Reconnect the Intel RealSense depth camera and run: realsense-viewer to verify the installation.

配置好了之后 输入realSense-viewer是这个样子~

2. 配置warpper----python环境

下载https://github.com/IntelRealSense/librealsense项目到本地

  

Building From Source Ubuntu 14.04/16.04 LTS Ensure apt-get is up to date
1、sudo apt-get update && sudo apt-get upgrade
Note: Use sudo apt-get dist-upgrade, instead of sudo apt-get upgrade, in case you have an older Ubuntu 14.04 version
Install Python and its development files via apt-get (Python 2 and 3 both work)
2、sudo apt-get install python python-dev or sudo apt-get install python3 python3-dev
Note: The project will only use Python 2 if it can‘t use Python 3
Run the top level CMake command with the following additional flag -DBUILD_PYTHON_BINDINGS=bool:true:

3、mkdir build
  cd build
  cmake ../ -DBUILD_PYTHON_BINDINGS=bool:true
Note: To force compilation with a specific version on a system with both Python 2 and Python 3 installed, add the following flag to CMake command: -DPYTHON_EXECUTABLE=[full path to the exact python executable]
(cmake常用套路了)
 make -j4
 sudo make install
4、update your PYTHONPATH environment variable to add the path to the pyrealsense library
export PYTHONPATH=$PYTHONPATH:/usr/local/lib

Alternatively, copy the build output (librealsense2.so and pyrealsense2.so) next to your script.
Note: Python 3 module filenames may contain additional information, e.g. pyrealsense2.cpython-35m-arm-linux-gnueabihf.so)

Python 接口使用的例子:

# First import the library
import pyrealsense2 as rs

try:
    # Create a context object. This object owns the handles to all connected realsense devices
    pipeline = rs.pipeline()
    pipeline.start()

    while True:
        # Create a pipeline object. This object configures the streaming camera and owns it‘s handle
        frames = pipeline.wait_for_frames()
        depth = frames.get_depth_frame()
        if not depth: continue

        # Print a simple text-based representation of the image, by breaking it into 10x20 pixel regions and approximating the coverage of pixels within one meter
        coverage = [0]*64
        for y in xrange(480):
            for x in xrange(640):
                dist = depth.get_distance(x, y)
                if 0 < dist and dist < 1:
                    coverage[x/10] += 1

            if y%20 is 19:
                line = ""
                for c in coverage:
                    line += " .:nhBXWW"[c/25]
                coverage = [0]*64
                print(line)

 

原文地址:https://www.cnblogs.com/z1141000271/p/10554341.html

时间: 2024-12-19 23:29:50

Intel realSense ubuntu 16.04+python 环境配置指南的相关文章

Ubuntu 16.04 + tesorflow环境配置

注:博主在踩了无数次坑之后,终于记得将配置环境过程中的问题和bug写下来 一.配置环境需求 一台纯净的ubuntu 16.04系统可上网的计算机 二.需要下载的软件 ? Anaconda 4.2(python 3.5 集成了很多python的开发包) ? Nvidia的关于你自己机器显卡的驱动 三.开始配置 1.安装Anaconda,去anaconda官网下载,推荐使用 清华镜像https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/ 下载安装. 2

Ubuntu 16.04 ROS环境配置

最近新入职一家公司,是搞智能无人驾驶的,用的操作系统是Ubuntu和ros,之前没接触过ros系统,既然公司用那就必须的学习啊,话不多说先装它一个ros玩玩... 1. Ubuntu 安装 ROS Kinetic 1.1Configure your Ubuntu repositories(配置您的Ubuntu存储库) 在系统设置中,找到软件与更新,将如下几个都勾选,允许其从互联网下载. 1.2 Setup your sources.list(设置你的计算机以接受packages.ros.org中

Ubuntu 18.04 实验环境配置

Ubuntu 18.04 实验环境配置 系统:Ubuntu 18.04 64bit 显卡:Nvidia GeForce 1080Ti 下载 CUDA.cuDNN.NVIDIA间存在某种关系,建议先确定要安装的CUDA版本. 注意:后续要安装的一些包不支持CUDA9.1. CUDA下载地址:https://developer.nvidia.com/cuda-toolkit-archive cuDNN下载地址:https://developer.nvidia.com/rdp/cudnn-archiv

Ubuntu 16.04 服务器上配置使用 docker

Docker基础概念 在使用Docker之前,我们先了解下几个Docker的核心概念 Docker Daemon Docker引擎,就是运行在后台的一个守护进程,在我们启动它之后,我们就可以通过Docker客户端发送相关Docker的命令. Docker Images Docker镜像,这个就类似于我们在安装Windows时的镜像,只不过windows的镜像,在以前我们通常存在光盘上或者U盘里,这里的镜像我们通常会发布到Docker Registry Docker Containers Dock

ubuntu 16.04 + python + matplotlib下画图显示中文设置

一.需求 因为在python画图显示的时候,经常需要展示一些中文,但是ubuntu系统下按照默认安装方式安装的时候,一般是不能显示中文的,当强行给legend.xlabel.ylabel赋予中文的时候,会显示为方块 二.参考 http://blog.csdn.net/onepiece_dn/article/details/46239581 三.配置方法 (1)  显示本机的同时可用的中文和西文字体 def dispFonts(): #显示可用的中文字体,同时支持英文的 from matplotl

Ubuntu 16.04LTS LNMP环境配置 -- 转(有修改)

1.安装mysql sudo apt install mysql-server 安装过程会提示密码 2.安装nginx和php #添加nginx和php的ppa源 sudo apt-add-repository ppa:nginx/stable sudo apt-add-repository ppa:ondrej/php sudo apt update sudo apt install nginx 安装好nginx,打开浏览器输入 http://localhost    看到 Welcome t

Ubuntu 16.04通过网络配置工具NetworkManager设置IP、网关、DNS和查看IP、网关、DNS

说明: 1.NetworkManager工具是Ubuntu桌面版的GUI设置工具. 2.这个工具推荐直接在GUI上操作,不建议用命令行进行管理,比如Wifi这些配置等. 3.当然,这个工具能带有命令行工具:nmcli,如果使用了NetworkManager进行配置网络,那么IP.网关.DNS都可以通过这个工具进行查询. 4.如果配置了命令行的网络设置,那么NetworkManager就会失效.参考:http://www.cnblogs.com/EasonJim/p/7857671.html 常用

ubuntu 16.04 python 3.x 安装OpenSSL

错误提示: Can't connect to HTTPS URL because the SSL module is not available. 连接HTTPS时,提示SSL不可用 测试 # 进入python $ python3 # or python3.6 # 导入SSL模块 >>> import ssl 如果出现下面提示,则Python不支持SSL. 解决方案 下载文件 OpenSSL $ wget http://www.openssl.org/source/openssl-1.0

【转】[Intel/Nvidia]Ubuntu 16.04 LTS Intel/Nvidia双显卡切换

1.在Unity中搜索 "Additional Drivers" 2.打开并选择以下选项 3.打开终端并输入 sudo apt-get install nvidia-361 4.安装Intel显卡驱动 sudo apt-get install intel-microcode 5.再次运行"Additional Drivers"并选择已经安装的显卡驱动: 6.打开NVIDIA X Server Settings,选择切换的显卡: http://www.linuxwan