person-head-coord.py代码更新

V0.1.0
fanpt 2 years ago
parent 77cb9cc384
commit 6475e6c3d1

@ -8,20 +8,19 @@ class VideoAnalysis():
"""
截取后图像保存视频
"""
x_min, y_min, x_max, y_max = person_coord['person']
# 提取出人的区域
person_frame = image[int(y_min)-100:int(y_max)+100, int(x_min)-100:int(x_max)+100, :]
x_min, y_min, x_max, y_max = person_coord[0]['person']
person_frame = image[int(y_min)-80:int(y_max)+80, int(x_min)-80:int(x_max)+80, :]
# 使用 YOLO 模型分析人体中头部和手部区域
head_result = analysis_yolov8(person_frame, YOLO(yolo_head_model), confidence)
hand_result = analysis_yolov8(person_frame, YOLO(yolo_hand_model), confidence)
# 如果检测到头部,返回头部坐标
if not head_result:
# 如果检测到头部,返回头部坐标,检测到手部,返回手部坐标
if head_result[1] != []:
return head_result[1]
# 如果检测到手部,返回手部坐标
elif not head_result:
if hand_result[3] != []:
return hand_result[3]

Loading…
Cancel
Save