実現したいこと
realsenseD435iをpythonで実行したいです。
google coraboratoryで実行しています。
pyrealsense2のバージョンは2.50.0.3812です。
実行コードは下記のサイトから
https://qiita.com/tom_eng_ltd/items/ae5f27b2d17edb1d47e5
#発生しているエラー
RuntimeEroor:
No device connected
#ソースコード
python
1import pyrealsense2 as rs 2import numpy as np 3import cv2 4 5# ストリーム(IR/Color/Depth)の設定 6config = rs.config() 7 8config.enable_stream(rs.stream.infrared, 1, 640, 480, rs.format.y8, 30) 9config.enable_stream(rs.stream.infrared, 2, 640, 480, rs.format.y8, 30) 10config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30) 11config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30) 12 13# ストリーミング開始 14pipeline = rs.pipeline() 15profile = pipeline.start(config) 16 17try: 18 while True: 19 # フレーム待ち 20 frames = pipeline.wait_for_frames() 21 #IR1 22 ir_frame1 = frames.get_infrared_frame(1) 23 ir_image1 = np.asanyarray(ir_frame1.get_data()) 24 25 #IR2 26 ir_frame2 = frames.get_infrared_frame(2) 27 ir_image2 = np.asanyarray(ir_frame2.get_data()) 28 29 #RGB 30 RGB_frame = frames.get_infrared_frame() 31 RGB_image = np.asanyarray(ir_frame2.get_data()) 32 33 #Depth 34 depth_frame = frames.get_depth_frame() 35 depth_image = np.asanyarray(depth_frame.get_data()) 36 37 #depth imageをカラーマップに変換 38 depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.08), cv2.COLORMAP_JET) 39 40 # 表示 41 cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE) 42 cv2.imshow('RealSense', depth_colormap) 43 44 if cv2.waitKey(1) & 0xff == 27: 45 cv2.destroyAllWindows() 46 break 47 48finally: 49 # ストリーミング停止 50 pipeline.stop()
#試したこと
intel.realsense.viewerでカメラは接続できました。

回答2件
あなたの回答
tips
プレビュー
下記のような回答は推奨されていません。
このような回答には修正を依頼しましょう。
また依頼した内容が修正された場合は、修正依頼を取り消すようにしましょう。