6
5

More than 1 year has passed since last update.

RealSense D435で300fpsのDepth画像を取得すーる(Python 3.6、Windows10)

Last updated at Posted at 2022-12-06

はじめに

300fpsのDepth画像を取得していきます

システム環境

  • Intel.RealSense.SDK-WIN10-2.49.0.3474.exe
  • librealsense-2.49.0
  • Python 3.6

RealSense Viewer

  • 1280 x 720 15fps RGB Depth IR Stereo
  • 848 x 480 60fps RGB IR Stereo
  • 640 x 480 60fps RGB Depth IR Stereo
  • 848 x 100 300fps Depth IR Stereo
  • 256 x 144 300fps Depth
Resolution RGB Depth FPS
256 x 144 - 300(○ Depth, x IR1, x IR2)
320 x 180 - 60
320 x 240 - 60
424 x 240 60, 90(○ Depth, x IR1, x IR2)
480 x 270 - 90(○ Depth, x IR1, x IR2)
640 x 360 60, 90(○ Depth, x IR1, x IR2)
640 x 400 - 25(x Depth, ○ IR1, ○ IR2)
640 x 480 60, 90(○ Depth, ○ IR1, ○ IR2)
848 x 100 - 300(○ Depth, ○ IR1, ○ IR2)
848 x 480 60, 90(x Depth, ○ IR1, ○ IR2)
960 x 540 - 60
1280 x 720 30, 15(○ Depth, ○ IR1, ○ IR2)
1280 x 800 - 15(x Depth, ○ IR1, ○ IR2)
1920 x 1080 - 30

Depth 300fps

import pyrealsense2 as rs
import numpy as np
import cv2
import time

pipeline = rs.pipeline()
config = rs.config()

pipeline_wrapper = rs.pipeline_wrapper(pipeline)
pipeline_profile = config.resolve(pipeline_wrapper)
device = pipeline_profile.get_device()
device_product_line = str(device.get_info(rs.camera_info.product_line))
print(device_product_line) # D400

config.enable_stream(rs.stream.depth, 848, 100, rs.format.z16, 300)
# config.enable_stream(rs.stream.infrared, 1, 848, 100, rs.format.y8, 300)
# config.enable_stream(rs.stream.infrared, 2, 848, 100, rs.format.y8, 300)

profile = pipeline.start(config)
depth_sensor = profile.get_device().first_depth_sensor()
depth_scale = depth_sensor.get_depth_scale()
print("Depth Scale is: " , depth_scale)

try:
    while True:
        start = time.time()

        frames = pipeline.wait_for_frames()
        depth_frame = frames.get_depth_frame()
        if not depth_frame: continue

        depth_image = np.asanyarray(depth_frame.get_data())
        # depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET)
        # cv2.imshow('depth', depth_colormap)
        key = cv2.waitKey(1)
        if key & 0xFF == ord('q') or key == 27:
            cv2.destroyAllWindows()
            break

        elapsed_time = time.time() - start
        print(1/elapsed_time)

finally:
    pipeline.stop()

image.png

depth_colormapを表示した場合

image.png

image.png

お疲れ様でした

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5