diff --git a/Vision/camera_coordinate_dete.py b/Vision/camera_coordinate_dete.py index 9f1e361..5e6c948 100644 --- a/Vision/camera_coordinate_dete.py +++ b/Vision/camera_coordinate_dete.py @@ -272,6 +272,30 @@ class Detection: print("RVC X Camera is not opened!") 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): self.camera_rvc.release() self.model.clear()