Intel Realsense D435 python wrapper pyrealsense.camera_info类(获取摄像头信息如序列号、名称、物理接口等)

# encoding: utf-8
# module pyrealsense2.pyrealsense2
# from D:\Yolov3_Tensorflow\python\lib\site-packages\pyrealsense2\pyrealsense2.cp36-win_amd64.pyd
# by generator 1.147
"""
LibrealsenseTM Python Bindings
        ==============================
        Library for accessing Intel RealSenseTM cameras
"""

# imports
import pybind11_builtins as __pybind11_builtins


class camera_info(__pybind11_builtins.pybind11_object):
    """ This information is mainly available for camera debug and troubleshooting and should not be used in applications. 
    此信息主要可用于相机调试和故障排除,不应在应用程序中使用 """
    def __eq__(self, *args, **kwargs): # real signature unknown; restored from __doc__
        """
        __eq__(*args, **kwargs)
        Overloaded function.
        
        1. __eq__(self: pyrealsense2.pyrealsense2.camera_info, arg0: pyrealsense2.pyrealsense2.camera_info) -> bool
        
        2. __eq__(self: pyrealsense2.pyrealsense2.camera_info, arg0: int) -> bool
        """
        pass

    def __getstate__(self): # real signature unknown; restored from __doc__
        """ __getstate__(self: pyrealsense2.pyrealsense2.camera_info) -> tuple """
        return ()

    def __hash__(self): # real signature unknown; restored from __doc__
        """ __hash__(self: pyrealsense2.pyrealsense2.camera_info) -> int """
        return 0

    def __init__(self, arg0): # real signature unknown; restored from __doc__
        """ __init__(self: pyrealsense2.pyrealsense2.camera_info, arg0: int) -> None """
        pass

    def __int__(self): # real signature unknown; restored from __doc__
        """ __int__(self: pyrealsense2.pyrealsense2.camera_info) -> int """
        return 0

    def __ne__(self, *args, **kwargs): # real signature unknown; restored from __doc__
        """
        __ne__(*args, **kwargs)
        Overloaded function.
        
        1. __ne__(self: pyrealsense2.pyrealsense2.camera_info, arg0: pyrealsense2.pyrealsense2.camera_info) -> bool
        
        2. __ne__(self: pyrealsense2.pyrealsense2.camera_info, arg0: int) -> bool
        """
        pass

    def __repr__(self): # real signature unknown; restored from __doc__
        """ __repr__(self: pyrealsense2.pyrealsense2.camera_info) -> str """
        return ""

    def __setstate__(self, arg0): # real signature unknown; restored from __doc__
        """ __setstate__(self: pyrealsense2.pyrealsense2.camera_info, arg0: tuple) -> None """
        pass

    advanced_mode = camera_info.advanced_mode # 高级模式(Yes 或 No)
    asic_serial_number = camera_info.asic_serial_number # 芯片序列号
    camera_locked = camera_info.camera_locked # 查看是否锁住?(Yes 或 No)
    debug_op_code = camera_info.debug_op_code
    firmware_update_id = camera_info.firmware_update_id
    firmware_version = camera_info.firmware_version
    name = camera_info.name	# 摄像头名字(如:D435)
    physical_port = camera_info.physical_port
    product_id = camera_info.product_id
    product_line = camera_info.product_line
    recommended_firmware_version = camera_info.recommended_firmware_version
    serial_number = camera_info.serial_number
    usb_type_descriptor = camera_info.usb_type_descriptor
    __members__ = {
        'advanced_mode': '',
        'asic_serial_number': '',
        'camera_locked': '',
        'debug_op_code': '',
        'firmware_update_id': '',
        'firmware_version': '',
        'name': '',
        'physical_port': '',
        'product_id': '',
        'product_line': '',
        'recommended_firmware_version': '',
        'serial_number': '',
        'usb_type_descriptor': '',
    }

测试camera_info各项参数

# -*- encoding: utf-8 -*-
"""
@File    : test_191125_测试rs.context().py
@Time    : 2019/11/25 9:08
@Author  : Dontla
@Email   : [email protected]
@Software: PyCharm
"""
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.bgr8, 30)

ctx = rs.context()

# 连接了两个Intel Realsense D435摄像头,打印发现每个摄像头有两个传感器;当连接D435i时,发现它有三个传感器

# (1)
# 生成所有RealSense设备中所有可用传感器的平铺列表
# print(ctx.query_all_sensors())
# [, , , ]

# (2)
# 为所有连接的设备创建静态快照
# print(ctx.query_devices())
# 

# for i in ctx.query_devices():
#     print(i)
# 
# 

for i in ctx.query_devices():
    # print(i)
    # 
    # 

    # print(type(i))
    # 
    # 

    # 打印(是否)高级模式
    # print(i.get_info(rs.camera_info.advanced_mode))
    # YES
    # YES

    # 打印芯片序列号(貌似不是我们调用摄像头时所需要的)
    # print(i.get_info(rs.camera_info.asic_serial_number))
    # 825513021803
    # 839313021607

    # print(i.get_info(rs.camera_info.camera_locked))
    # YES
    # YES

    # 不知道是啥玩意?
    # print(i.get_info(rs.camera_info.debug_op_code))
    # 15
    # 15

    # 这又是啥玩意,怎么跟芯片号一样的?
    # print(i.get_info(rs.camera_info.firmware_update_id))
    # 825513021803
    # 839313021607

    # print(i.get_info(rs.camera_info.firmware_version))
    # 825513021803
    # 05.11.06.250
    # 839313021607
    # 05.11.11.100

    # 打印摄像头名字
    # print(i.get_info(rs.camera_info.name))
    # Intel RealSense D435
    # Intel RealSense D435

    # print(i.get_info(rs.camera_info.physical_port))
    # \\?\usb#vid_8086&pid_0b07&mi_00#7&2cc25724&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
    # \\?\usb#vid_8086&pid_0b07&mi_00#7&2d0c9e7a&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global

    # print(i.get_info(rs.camera_info.product_id))
    # 0B07
    # 0B07

    # print(i.get_info(rs.camera_info.product_line))
    # D400
    # D400

    # 推荐的固件版本
    # print(i.get_info(rs.camera_info.recommended_firmware_version))
    # 05.11.15.00
    # 05.11.15.00

    # 打印摄像头序列号
    # print(i.get_info(rs.camera_info.serial_number))
    # 827312070790
    # 836612072369

    # 打印已连接摄像头的USB接口描述符,有时重启后摄像头又没了。以后可用这个来判断摄像头的接口是否适配
    print(i.get_info(rs.camera_info.usb_type_descriptor))
    # 一开始为:
    # 3.2
    # 2.1
    # 重新插拔后,变成:
    # 3.2
    # 3.2

你可能感兴趣的:(Intel,RealSense)