UPDATE Vision 更新方法:获取图像中心点云数据,用于寻找拍照点

This commit is contained in:
HJW
2024-09-27 18:00:23 +08:00
parent a101b52c36
commit 5d526875b2

View File

@ -272,6 +272,30 @@ class Detection:
print("RVC X Camera is not opened!") print("RVC X Camera is not opened!")
return 0, None, None, None, None return 0, None, None, None, None
def get_center_position(self):
""
'''
:param api: None
:return: ret , img, (x,y,z) 图像中心点位置对应的点云数据
'''
ret, img, pm = self.camera_rvc.get_img_and_point_map() # 拍照,获取图像及
if self.camera_rvc.caminit_isok == True:
if ret:
if pm != 'None':
pm_shape_y = pm.shape[0]
pm_shape_x = pm.shape[1]
center_point = [int(pm_shape_y/2), int(pm_shape_x/2)]
point_x, point_y, point_z = remove_nan_mean_value(pm, center_point[0], center_point[1])
return img, [point_x, point_y, point_z]
else:
print('点云值为NAN')
return None, None
else:
return None, None
else:
return None, None
def release(self): def release(self):
self.camera_rvc.release() self.camera_rvc.release()
self.model.clear() self.model.clear()