欢迎光临散文网 会员登陆 & 注册

深度CV项目就业小班第9期

2022-09-10 23:03 作者:哦呵呵嬷嬷  | 我要投稿

CV项目肢体动作识别

代码:

import CV2import(已报名深度之👀 获课底部) mediapipe as mpimport time mpDraw = mp.solutions.drawing_utils mpPose = mp.solutions.pose pose = mpPose.Pose()cap = CV2.VideoCapture('PoseVideos/3.mp4')pTime = 0while True:    success, img = cap.read()    imgRGB = CV2.cvtColor(img, CV2.COLOR_BGR2RGB)    results = pose.process(imgRGB)    # print(results.pose_landmarks)    if results.pose_landmarks:        mpDraw.draw_landmarks(img, results.pose_landmarks, mpPose.POSE_CONNECTIONS)        for id, lm in enumerate(results.pose_landmarks.landmark):            h, w, c = img.shape            print(id, lm)            cx, cy = int(lm.x * w), int(lm.y * h)            CV2.circle(img, (cx, cy), 5, (255, 0, 0), CV2.FILLED)    cTime = time.time()    fps = 1 / (cTime - pTime)    pTime = cTime    CV2.putText(img, str(int(fps)), (70, 50), CV2.FONT_HERSHEY_PLAIN, 3,                (255, 0, 0), 3)    CV2.imshow("Image", img)    CV2.waitKey(1)


深度CV项目就业小班第9期的评论 (共 条)

分享到微博请遵守国家法律