From 5d526875b2f58f404d8ca2b4321a4648c0e36043 Mon Sep 17 00:00:00 2001 From: HJW <1576345902@qq.com> Date: Fri, 27 Sep 2024 18:00:23 +0800 Subject: [PATCH] =?UTF-8?q?UPDATE=20Vision=20=E6=9B=B4=E6=96=B0=E6=96=B9?= =?UTF-8?q?=E6=B3=95=EF=BC=9A=E8=8E=B7=E5=8F=96=E5=9B=BE=E5=83=8F=E4=B8=AD?= =?UTF-8?q?=E5=BF=83=E7=82=B9=E4=BA=91=E6=95=B0=E6=8D=AE=EF=BC=8C=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E5=AF=BB=E6=89=BE=E6=8B=8D=E7=85=A7=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Vision/camera_coordinate_dete.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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()