UPDATE Vision
This commit is contained in:
@ -24,15 +24,18 @@ class Detection:
|
||||
self.camera_rvc = camera()
|
||||
self.model = yolov8_segment()
|
||||
self.model.load_model(model_path, device)
|
||||
if self.camera_rvc.caminit_isok == True:
|
||||
print("RVC X Camera is opened!")
|
||||
else:
|
||||
print("RVC X Camera is not opened!")
|
||||
# if self.camera_rvc.caminit_isok == True:
|
||||
# print("RVC X Camera is opened!")
|
||||
# else:
|
||||
# print("RVC X Camera is not opened!")
|
||||
|
||||
def get_position(self, Point_isVision=True):
|
||||
def get_position(self, Point_isVision=False, first_depth=False):
|
||||
""
|
||||
'''
|
||||
:param api: None
|
||||
:param api:
|
||||
Point_isVision: 点云可视化
|
||||
first_depth: 按Z轴深度返回坐标及向量
|
||||
|
||||
:return: ret , img, (x,y,z), (nx, ny, nz)
|
||||
'''
|
||||
ret, img, pm = self.camera_rvc.get_img_and_point_map() # 拍照,获取图像及
|
||||
@ -110,6 +113,9 @@ class Detection:
|
||||
pm_seg = select_point.reshape(-1, 3)
|
||||
pm_seg = pm_seg[~np.isnan(pm_seg).all(axis=-1), :] # 剔除 nan
|
||||
# cv2.imshow('result', piont_result)
|
||||
if pm_seg.size < 300:
|
||||
print("分割出的点云数量较少,无法拟合平面!")
|
||||
continue
|
||||
|
||||
'''
|
||||
拟合平面,计算法向量
|
||||
@ -157,7 +163,7 @@ class Detection:
|
||||
seg_point.append(pm_seg)
|
||||
cv2.polylines(img, [box], True, (0, 255, 0), 2)
|
||||
|
||||
_idx = find_position(Depth_Z, RegionalArea, 100,True)
|
||||
_idx = find_position(Depth_Z, RegionalArea, 100, first_depth)
|
||||
|
||||
if _idx == None:
|
||||
return 1, img, None, None
|
||||
|
||||
Reference in New Issue
Block a user