UPDATE Vision 限定料袋的图像中心点
This commit is contained in:
@ -66,7 +66,7 @@ class Detection:
|
||||
self.model = yolov8_segment_openvino(model_path, device, conf_thres=0.3, iou_thres=0.3)
|
||||
|
||||
|
||||
def get_position(self, Point_isVision=False, Box_isPoint=True, First_Depth =True, Iter_Max_Pixel = 30, save_img_point=0, Height_reduce = 60, width_reduce = 100):
|
||||
def get_position(self, Point_isVision=False, Box_isPoint=True, First_Depth =True, Iter_Max_Pixel = 30, save_img_point=0, Height_reduce = 60, width_reduce = 100, Xmin =330, Xmax = 1050, Ymin =290 ,Ymax = 690 ):
|
||||
"""
|
||||
检测料袋相关信息
|
||||
:param Point_isVision: 点云可视化
|
||||
@ -76,6 +76,10 @@ class Detection:
|
||||
:param save_img_point: 0不保存 ; 1保存原图 ;2保存处理后的图 ; 3保存点云和原图;4 保存点云和处理后的图; 5 异常数据保存(点云NAN)
|
||||
:param Height_reduce: 检测框的高内缩像素
|
||||
:param width_reduce: 检测框的宽内缩像素
|
||||
:param Xmin: 限定中心点的范围
|
||||
:param Xmax: 限定中心点的范围
|
||||
:param Ymin: 限定中心点的范围
|
||||
:param Ymax: 限定中心点的范围
|
||||
:return ret: bool 相机是否正常工作
|
||||
:return img: ndarray 返回img
|
||||
:return xyz: list 目标中心点云值形如[x,y,z]
|
||||
@ -261,6 +265,8 @@ class Detection:
|
||||
x_rotation_center = int((box[0][0][0] + box[1][0][0] + box[2][0][0] + box[3][0][0]) / 4)
|
||||
y_rotation_center = int((box[0][0][1] + box[1][0][1] + box[2][0][1] + box[3][0][1]) / 4)
|
||||
point_x, point_y, point_z = remove_nan_mean_value(pm, y_rotation_center, x_rotation_center, iter_max=Iter_Max_Pixel)
|
||||
if x_rotation_center<Xmin or x_rotation_center>Xmax or y_rotation_center<Ymin or y_rotation_center>Ymax:
|
||||
continue
|
||||
cv2.circle(img, (x_rotation_center, y_rotation_center), 4, (255, 255, 255), 5) # 标出中心点
|
||||
if np.isnan(point_x): # 点云值为无效值
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user