Bye Bye Moore

PoCソルジャーな零細事業主が作業メモを残すブログ

RealSense SDK for Pythonを Ubuntu22LTS on Raspi4B で試す その3:特定以上の高さ情報をおくる

実際のところ

import pyrealsense2 as rs
import numpy as np

conf = rs.config()

# 高さ情報を取得
conf.enable_stream(rs.stream.depth, 1280, 720, rs.format.z16, 30)

pipe = rs.pipeline()
profile = pipe.start(conf)
x = 100
y = 100

while True:
    frames = pipe.wait_for_frames()
    depth_frame = frames.get_depth_frame()
    depth_data = depth_frame.get_distance(x,y)
    print(depth_data)