初心者です。
こちらを参考にRealSenseD430をPythonで動かそうとしています。
Python
1# -*- coding: utf-8 -*- 2 3############################################# 4## D415 Depth画像の表示 5############################################# 6import pyrealsense2 as rs 7import numpy as np 8import cv2 9 10# ストリーム(Color/Depth)の設定 11config = rs.config() 12config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) 13config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) 14 15# ストリーミング開始 16pipeline = rs.pipeline() 17profile = pipeline.start(config) 18 19try: 20 while True: 21 # フレーム待ち(Color & Depth) 22 frames = pipeline.wait_for_frames() 23 color_frame = frames.get_color_frame() 24 depth_frame = frames.get_depth_frame() 25 if not depth_frame or not color_frame: 26 continue 27 color_image = np.asanyarray(color_frame.get_data()) 28 # Depth画像 29 depth_color_frame = rs.colorizer().colorize(depth_frame) 30 depth_color_image = np.asanyarray(depth_color_frame.get_data()) 31 32 # 表示 33 images = np.hstack((color_image, depth_color_image)) 34 cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE) 35 cv2.imshow('RealSense', images) 36 if cv2.waitKey(1) & 0xff == 27: 37 break 38 39finally: 40 # ストリーミング停止 41 pipeline.stop() 42 cv2.destroyAllWindows()
こちらのコードを実行した結果、以下のようになります。
result
1RuntimeError Traceback (most recent call last) 2<ipython-input-1-62c2d4a13eee> in <module>() 3 15 # ストリーミング開始 4 16 pipeline = rs.pipeline() 5---> 17 profile = pipeline.start(config) 6 18 7 19 try: 8 9RuntimeError: Couldn't resolve requests
対処の方法のほどをご教授いただきたいです。
よろしくお願いいたします。
あなたの回答
tips
プレビュー