Python + OpenCV + openpose实现人手关键点检测

编程入门 行业动态 更新时间:2024-10-09 05:21:29

Python + OpenCV + openpose实现<a href=https://www.elefans.com/category/jswz/34/1745972.html style=人手关键点检测"/>

Python + OpenCV + openpose实现人手关键点检测

import cv2
import mediapipe as mp
import time# 调用摄像头
cap = cv2.VideoCapture(0)mpHands = mp.solutions.hands
hands = mpHands.Hands()
mpDraw = mp.solutions.drawing_utilspTime = 0
cTime = 0while True:success, img = cap.read()imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)results = hands.process(imgRGB)#print(results.multi_hand_landmarks)if results.multi_hand_landmarks:for handLms in results.multi_hand_landmarks:for id, lm in enumerate(handLms.landmark):# print(id, lm)h, w, c = img.shapecx, cy = int(lm.x * w), int(lm.y * h)print(id, cx, cy)# if id == 4:cv2.circle(img, (cx,cy), 5, (255, 0, 255), cv2.FILLED)mpDraw.draw_landmarks(img, handLms,mpHands.HAND_CONNECTIONS)cTime = time.time()fps = 1 / (cTime - pTime)pTime = cTimecv2.putText(img, str(int(fps)), (10,70), cv2.FONT_HERSHEY_PLAIN, 3, (255, 123, 255), 3)cv2.imshow("Image", img)cv2.waitKey(1)

更多推荐

Python + OpenCV + openpose实现人手关键点检测

本文发布于:2024-02-19 12:52:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1764143.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:人手   关键   Python   OpenCV   openpose

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!