realsense相机两种获取相机内外参的方式

2023-05-16

https://www.it610.com/article/1296417297711308800.htm

命令:~$ rs-sensor-control

这个命令是一个exe文件,可以去·C:\Program Files (x86)\Intel RealSense SDK 2.0\tools下找到

======================================================

Found the following devices:

  0 : Intel RealSense D435 #817612070563

然后选择 0

Select a device by index: 0

Device information: 
  Name                 : Intel RealSense D435
  Serial Number        : 817612070563
  Firmware Version     : 05.10.06.00
  Recommended Firmware Version : 05.10.03.00
  Physical Port        : /sys/devices/pci0000:00/0000:00:14.0/usb2/2-8/2-8:1.0/video4linux/video0
  Debug Op Code        : 15
  Advanced Mode        : YES
  Product Id           : 0B07
  Camera Locked        : N/A
  Usb Type Descriptor  : 3.2

======================================================

Device consists of 2 sensors:

  0 : Stereo Module
  1 : RGB Camera

Select a sensor by index: 

然后比如选择1
Select a sensor by index: 1

======================================================

What would you like to do with the sensor?

0 : Control sensor's options
1 : Control sensor's streams
2 : Show stream intrinsics
3 : Display extrinsics

Select an action: 

注意第二项,这个就是内参的内容了。选择2

======================================================

Sensor consists of 1 streams: 
  - Color #0
Sensor provides the following stream profiles:
0  : Color #0 (Video Stream: RGB8 1920x1080@ 30Hz)
1  : Color #0 (Video Stream: RAW16 1920x1080@ 30Hz)
2  : Color #0 (Video Stream: Y16 1920x1080@ 30Hz)
3  : Color #0 (Video Stream: BGRA8 1920x1080@ 30Hz)
4  : Color #0 (Video Stream: RGBA8 1920x1080@ 30Hz)
5  : Color #0 (Video Stream: BGR8 1920x1080@ 30Hz)
6  : Color #0 (Video Stream: YUYV 1920x1080@ 30Hz)
... ...  

Please select the desired streaming profile: 

所有流都在这里了,比如,选择0

Please select the desired streaming profile: 0

Principal Point         : 966.617, 532.934
Focal Length            : 1395.12, 1395.28
Distortion Model        : Brown Conrady
Distortion Coefficients : [0,0,0,0,0]

相机的内参矩阵是

K = fx		s		x0
   	  0		fy		y0
	  0		0		1

fx,fy为焦距,一般情况下,二者相等。
x0,y0为主坐标(相对于成像平面)。
s为坐标轴倾斜参数,理想情况下为0。

 

python pipeline

import pyrealsense2 as rs

pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 30)
pipeline.start(config)

time.sleep(1)
frames = pipeline.wait_for_frames()
# time.sleep(3)
depth_frame = frames.get_depth_frame()
color_frame = frames.get_color_frame()

    # Convert images to numpy arrays
depth_image = np.asanyarray(depth_frame.get_data())
color_image = np.asanyarray(color_frame.get_data())

# # Apply colormap on depth image (image must be converted to 8-bit per pixel first)
# depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET)
#
# # Stack both images horizontally
# images = np.hstack((color_image, depth_colormap))
#
# # Show images
# cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)
# cv2.imshow('RealSense', images)
# cv2.waitKey(1)

fig, axes = plt.subplots(1, 2)
for ax, im in zip(axes, [color_image, depth_image]):
    ax.imshow(im)
    ax.axis('off')
plt.show()
pipeline.stop()

在此网页中介绍了各个相机内参分别是什么(fx,fy,ppx,ppy等)
在此网页中给出了通过python script获取内参的方法
python script: get intrinsic

import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 30)
cfg = pipeline.start(config)
time.sleep(1)
profile = cfg.get_stream(rs.stream.depth)
intr = profile.as_video_stream_profile().get_intrinsics()
print(intr)  # 获取内参 width: 640, height: 480, ppx: 319.115, ppy: 234.382, fx: 597.267, fy: 597.267, model: Brown Conrady, coeffs: [0, 0, 0, 0, 0]
319.1151428222656
print(intr.ppx)  # 获取指定某个内参

注意!!!通过python script获取内参一定要看好自己到底用了哪个video stream, 不要无脑复制代码
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

realsense相机两种获取相机内外参的方式 的相关文章

随机推荐

  • 使用HAL库驱动WS2812 LED的STM32F401代码示例

    使用HAL库驱动WS2812 LED的STM32F401代码示例 include 34 stm32f4xx hal h 34 include lt stdlib h gt define LED COUNT 10 TIM HandleType
  • 开源项目-esp32—S3+lvgl智能手表

    23 5 4 QF ZERO V2 V1 0 2 智能手表终端 嘉立创EDA开源硬件平台 oshwhub com 致敬大神 硬件资源 xff1a 1 xff09 ESP32 S3 为核心主控 xff0c 负责复杂的运算与交互处理 xff0c
  • nRF52832芯片使用ADC的代码示例

    nRF52832芯片使用ADC的代码示例 define ADC REF VOLTAGE IN MILLIVOLTS 600 lt Reference voltage in millivolts used by ADC while doing
  • nRF52832的I2C例程代码

    nRF52832的I2C例程代码 include 34 nrf drv i2c h 34 include 34 app error h 34 define I2C SCL PIN 0 SCL引脚号 define I2C SDA PIN 1
  • HX711 24位A/D模块计算公式

    基本原理讲解 100kg 传感器 满量程输出电压 61 激励电压 灵敏度2 0mv v 例如 xff1a 供电电压是5v 乘以灵敏度2 0mv v 61 满量程10mv 相当于有100Kg 重力产生时候产生10mV 的电压 711模块对产生
  • stm32 keil实现串口printf输出中文字符

    添加如下代码 xff0c 可以GNUC的方式实现 span class hljs comment ifdef GNUC span With GCC RAISONANCE small printf option LD Linker gt Li
  • stm32 基于TIM1定时器的PWM输出

    void PWM TIM1 uint16 t arr uint16 t psc RCC APB2PeriphClockCmd RCC APB2Periph TIM1 ENABLE 定时器TIM1时钟使能 TIM DeInit TIM1 设置
  • stm32 can总线参考例程

    CAN初始化 tsjw 重新同步跳跃时间单元 范围 1 3 CAN SJW 1tq CAN SJW 2tq CAN SJW 3tq CAN SJW 4tq tbs2 时间段2的时间单元 范围 1 8 tbs1 时间段1的时间单元 范围 1
  • 物联网IOT-mqtt协议

    MQTT是一种客户机服务器发布 订阅消息传递传输协议 它重量轻 开放 简单 设计简单 易于实现 这些特性使其非常适合在许多情况下使用 xff0c 包括受限的环境 xff0c 如机器间通信 M2M 和物联网 IoT 环境 xff0c 在这些环
  • 联合索引的最左匹配原则的成因

    联合索引的最左匹配原则的成因 上面我们只看的是单一的索引 xff0c 接下来咱们来看看联合索引 xff0c 也就是回答第二个问题 联合索引的最左匹配原则的成因 什么是联合索引呢 xff0c 就是由多列组成的索引了 那亦要了解其成因 xff0
  • 腾讯云轻量服务器的Ubuntu如何使用root(根)用户登陆ssh/Shell/terminal/终端/WindTerm/FinalShell

    Ubuntu 系统的默认用户名是 ubuntu xff0c 并在安装过程中默认不设置 root 帐户和密码 您如有需要 xff0c 可在设置中开启允许 root 用户登录 具体操作步骤如下 xff1a 使用 ubuntu 帐户登录轻量应用服
  • Ubuntu安装sshd服务

    ubuntu安装ssh服务 一 安装shhd SSH分客户端openssh client和openssh server 如果你只是想登陆别的机器的SSH只需要安装openssh client xff08 ubuntu有默认安装 xff0c
  • Linux环境(六)--资源与限制

    资源与限制 运行在Linux系统上的程序是有资源限制的 这些也许是硬件引起的限制 例如内存 xff0c 也许由系统策略引起的限制 例如 xff0c 允许 的CPU时间 xff0c 或者是实现的限制 例如 xff0c 整数的尺寸或是文件名允许
  • 遇到了C/C++控制台程序无法输入中文的情况

    其实C C 43 43 控制台程序无法cin中文的情况并不是你使用了string xff0c string是能输入并保存中文的 xff1b 经过一番探究 xff0c 我发现主要的问题是文件的编码和控制台所处的代码页 xff08 控制台的编码
  • Jpg2Dcm中文乱码问题

    Jpg2Dcm中文乱码问题 最近老板提出了一个新的功能要求 xff0c 希望可以把图片转成dcm 在实现功能的问题中遇见了很多问题和掉过许多坑 于是在此记录下来 问题 xff1a 第一次在进行Jpg2Dcm时 xff0c 可以进行图片转dc
  • 神经网络的数学表达式,神经网络的数学理论

    什么是神经网络 神经网络可以指向两种 xff0c 一个是生物神经网络 xff0c 一个是人工神经网络 生物神经网络 xff1a 一般指生物的大脑神经元 xff0c 细胞 xff0c 触点等组成的网络 xff0c 用于产生生物的意识 xff0
  • python装饰器详解(四)---把参数传递给装饰器

    因为装饰器必须接收一个函数当做参数 所以 不可以直接把被装饰函数的参数传递给装饰器 装饰器就是一个普通的函数 xff0c 回顾 def my decorator func print 34 I am an ordinary function
  • Motion Deblurring图像运动去模糊代码

    http www di ens fr whyte Efficient Deblurring for Shaken and Partially Saturated Images http www di ens fr willow resear
  • maven执行install时报错 The packaging for this project did not assign a file to the build artifact

    问题描述 maven中执行plugins下面的install install时会报如下错误 span class token class name Failed span span class token keyword to span s
  • realsense相机两种获取相机内外参的方式

    https www it610 com article 1296417297711308800 htm 命令 xff1a rs sensor control 这个命令是一个exe文件 xff0c 可以去 C Program Files x8