Contents

camera:深度相机realsense(D450)介绍

本文采用知识共享署名 4.0 国际许可协议进行许可,转载时请注明原文链接,图片在使用时请保留全部内容,可适当缩放并在引用处附上图片所在的文章链接。

原理

Interl RealSence D4×× 系列,都是采用经典的双目视觉的方式测量深度。尽管具有红外投射器,但并不是采用红外反射测距。它的作用仅仅是投射不可见的固定的红外纹理样式,提高在纹理不明显的1环境中(例如白墙)的深度计算精度,辅助双目视觉测距。左右两个相机将图像数据送入内置的深度处理器,在其中基于双目测距的原理计算每个像素的深度值。

https://cdn.jsdelivr.net/gh/zhangyuhu/share_images/images/202301302001185.png

D455/450技术规格

参数表

特性 使用环境: 室内/室外 深度快门类型: 全局快门,3μm × 3μm 像素大小 推荐范围: 0.6-6 米 惯性量测单元: Bosch BMI055
深度 深度技术: 主动 IR 立体 最小深度距离 (Min-Z): ~0.52 米 深度精度 <2% 位于4 米1 深度视场 (FOV): 86° × 57° (±3°) 深度输出分辨率: 高达 1280 x 720 深度帧率: 高达 90 帧/秒
RGB RGB帧分辨率: 高达 1280 × 800 RGB 帧速率: 30 帧/秒 RGB 传感器技术: 全局快门 RGB 传感器 FOV (H × V): 90° × 65° (±3) RGB传感器分辨率: 1 MP
主要组件 摄像头模块: 英特尔实感模块 D450 计算处理器板: 英特尔实感视觉处理器 D4
物理 外形: 摄像头外设 长度 × 深度 × 高度: 124 毫米 × 26 毫米 × 29 毫米 接头: USB‑C* 3.1 Gen 1* 安装机构: – 一个 1/4‑20 UNC 螺纹安装点。 – 两个 M3 螺纹安装点。 – 三脚架

Invalid Depth Band

The depth data generated with stereo vision uses the left imager as the reference for stereo matching resulting in a non-overlap region in the field of view of left and right imagers where we will not have depth data at the left edge of the frame. Closer scenes result in a wider invalid depth band than scenes at larger distances.

https://cdn.jsdelivr.net/gh/zhangyuhu/share_images/images/202301302001383.png

Depth Quality Specification

FOV 80% 做评估

METRIC DEFINITION
Depth Accuracy : 深度精度 测量相对于地面真实表面的有效像素的差异。
Fill Rate:Fill Rate 具有有效深度值的像素百分比。
Depth Standard Deviation :深度标准差 测量每个有效像素相对于最佳拟合平面的总空间噪声。
Pixel Temporal Noise:像素时间噪声 测量相对于最佳拟合平面的每个有效像素的总时间噪声。

https://cdn.jsdelivr.net/gh/zhangyuhu/share_images/images/202301302001769.png

软件开发

sdk 及开发者文档

开发者支持

Linux/Ubuntu - RealSense SDK 2.0 Build Guide

List of Intel RealSense SDK 2.0 Examples

API How To

PC 安装realsense SDK

Ubuntu下Realsense SDK的安装 下载源码

1
git clone https://github.com/IntelRealSense/librealsense.git

安装依赖环境

1
sudo apt-get install libusb-1.0-0-dev libglfw3-dev libgtk-3-dev

libusb是一个USB设备访问接口库

gtk是一个图形工具包

glfw是一个OpenGL应用框架

将英特尔服务器添加到存储库列表中

1
echo 'deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo xenial main' | sudo tee /etc/apt/sources.list.d/realsense-public.list

注册服务器的公钥

1
sudo apt-key adv --keyserver keys.gnupg.net --recv-key 6F3EFCDE

刷新apt列表

1
sudo apt-get update

安装相关包

1
2
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils

dkms是内核驱动包,utils是工具包

检查安装

1
modinfo uvcvideo | grep "version:" 

终端会返回相关版本信息

比如我的电脑上会返回

1
2
3
zyh@zyh ~ $ modinfo uvcvideo | grep "version:" 
version:        1.1.1
srcversion:     32217DB1DE9B0BC725EDF5D

编译

1
2
3
4
5
6
cd librealsense
mkdir build
cd build
cmake ..
make -j8
sudo make install

realsense 获取深度、彩色相机内参外参

1
2
3
4
rs2_intrinsics depth_intrin = depth_profile.as<rs2::video_stream_profile>().get_intrinsics();
rs2_intrinsics color_intrin = color_profile.as<rs2::video_stream_profile>().get_intrinsics();
rs2_extrinsics depth_extrin_to_color = depth_profile.as<rs2::video_stream_profile>().get_extrinsics_to(color_profile);
rs2_extrinsics color_extrin_to_depth = color_profile.as<rs2::video_stream_profile>().get_extrinsics_to(depth_profile);

rs2_intrinsics:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
/** \brief Video stream intrinsics. */
typedef struct rs2_intrinsics
{
    int           width;     /**< Width of the image in pixels */
    int           height;    /**< Height of the image in pixels */
    float         ppx;       /**< Horizontal coordinate of the principal point of the image, as a pixel offset from the left edge */
    float         ppy;       /**< Vertical coordinate of the principal point of the image, as a pixel offset from the top edge */
    float         fx;        /**< Focal length of the image plane, as a multiple of pixel width */
    float         fy;        /**< Focal length of the image plane, as a multiple of pixel height */
    rs2_distortion model;    /**< Distortion model of the image */
    float         coeffs[5]; /**< Distortion coefficients. Order for Brown-Conrady: [k1, k2, p1, p2, k3]. Order for F-Theta Fish-eye: [k1, k2, k3, k4, 0]. Other models are subject to their own interpretations */
} rs2_intrinsics;

rs2_extrinsics:

1
2
3
4
5
6
/** \brief Cross-stream extrinsics: encodes the topology describing how the different devices are oriented. */
typedef struct rs2_extrinsics
{
    float rotation[9];    /**< Column-major 3x3 rotation matrix */
    float translation[3]; /**< Three-element translation vector, in meters */
} rs2_extrinsics;

realsense 设置laser开关

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
rs2::pipeline pipe; 
rs2::pipeline_profile selection = pipe.start();
rs2::device selected_device = selection.get_device();
auto depth_sensor = selected_device.first<rs2::depth_sensor>();

if (depth_sensor.supports(RS2_OPTION_EMITTER_ENABLED))
{
    depth_sensor.set_option(RS2_OPTION_EMITTER_ENABLED, 1.f); // Enable emitter
    depth_sensor.set_option(RS2_OPTION_EMITTER_ENABLED, 0.f); // Disable emitter
}
if (depth_sensor.supports(RS2_OPTION_LASER_POWER))
{
    // Query min and max values:
    auto range = depth_sensor.get_option_range(RS2_OPTION_LASER_POWER);
    depth_sensor.set_option(RS2_OPTION_LASER_POWER, range.max); // Set max power
    depth_sensor.set_option(RS2_OPTION_LASER_POWER, 0.f); // Disable laser
}