Question
Intel Realsense D435 开始运行启动时报错:RuntimeError: Couldn’t resolve requests
利用d435 rgb frame拍摄图像时出现如下错误:
Traceback (most recent call last):
File "E:\ProgramData\Anaconda3\envs\Develop\lib\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-2-83d4be2340b2>", line 1, in <module>
runfile('shot.py', wdir='dataset')
File "E:\Program Files\JetBrains\PyCharm 2020.3\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "E:\Program Files\JetBrains\PyCharm 2020.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "shot.py", line 11, in <module>
pipe_profile = pipeline.start(config)
RuntimeError: Couldn't resolve requests
代码:
import time
import numpy as np
import pyrealsense2 as rs
import cv2
framerate = 15
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, framerate)
pipe_profile = pipeline.start(config)
save_path = "./images_jpg/"
shot_flag = False
while True:
frames = pipeline.wait_for_frames()
color_frame = frames.get_color_frame()
img_color = np.asanyarray(color_frame.get_data())
cv2.imshow("q", img_color)
key = cv2.waitKey(1)
if key & 0xFF == ord('q'):
break
elif key & 0xFF == ord('s'):
shot_flag = ~shot_flag
print("shot flag "+str(shot_flag))
if shot_flag:
cv2.imwrite(save_path + str(time.time()) + ".jpg", img_color)
Answer
检查后发现是帧率设置过低导致的,网上也有人因为线过长导致无法启动,如果使用较长的数据线,可以先提高帧率试试看。