问题描述
我正在使用英特尔实感 pyrealsense2 API 提供的 helper_function:
from helper_functions import get_depth_at_pixel,convert_depth_pixel_to_metric_coordinate
depth_val= get_depth_at_pixel(depth_frame,x,y)
x_m,y_m,z_m = convert_depth_pixel_to_metric_coordinate(depth_val,y,intrinsics)
print(" metric x {},y{},z{} and also depth{}".format(x_m,z_m,depth_val))
我收到此错误:
'numpy.ndarray' object has no attribute 'as_depth_frame'
这是 helper_functions.py 中的相关部分:
def get_depth_at_pixel(depth_frame,pixel_x,pixel_y):
"""
Get the depth value at the desired image point
Parameters:
-----------
depth_frame : rs.frame()
The depth frame containing the depth information of the image coordinate
pixel_x : double
The x value of the image coordinate
pixel_y : double
The y value of the image coordinate
Return:
----------
depth value at the desired pixel
"""
return depth_frame.as_depth_frame().get_distance(round(pixel_x),round(pixel_y))
我的depth_frame形状和类型如下:
<class 'numpy.ndarray'>
(720,1280)
我什至尝试将 depth_frame 转换为浮动,但效果不佳。
depth_float = original_depth_frame.astype(np.float32)
我应该如何解决这个问题?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)