当前位置:网站首页>Key point detection of human hand based on mediapipe
Key point detection of human hand based on mediapipe
2022-04-23 03:35:00 【Crispy eggplant strips】
MediaPipe It is an open source algorithm framework of Google , Integrated face recognition , Human posture evaluation and hand detection model .
windows Under the MediaPipe install
pip install mediapipe
Be careful :ARM Architecture doesn't have python Under the mediapipe, at present mediapipe Only support x86 framework , I won't support it arm framework , As shown in the figure below .
The code is as follows :
""" Key point detection of hand """
import cv2
import mediapipe as mp
import time
cap = cv2.VideoCapture(0)
mpHands = mp.solutions.hands
hands = mpHands.Hands(static_image_mode=False,
max_num_hands=2,
min_detection_confidence=0.5,
min_tracking_confidence=0.5)
mpDraw = mp.solutions.drawing_utils
pTime = 0
cTime = 0
while True:
success, img = cap.read()
img = cv2.flip(img, 1)
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.shape
cx, cy = int(lm.x *w), int(lm.y*h)
print(cx,cy)
#if id ==0:
cv2.circle(img, (cx,cy), 3, (255,0,255), cv2.FILLED)
mpDraw.draw_landmarks(img, handLms, mpHands.HAND_CONNECTIONS)
cTime = time.time()
fps = 1/(cTime-pTime)
pTime = cTime
cv2.putText(img,str(int(fps)), (10,70), cv2.FONT_HERSHEY_PLAIN, 3, (255,0,255), 3)
cv2.imshow("Image", img)
cv2.waitKey(1)
版权声明
本文为[Crispy eggplant strips]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220602452012.html
边栏推荐
- Section 1 array and slicing in Chapter 6
- Detailed description of MySQL index [B + tree index, hash index, full-text index, overlay index]
- L3-011 直捣黄龙 (30 分)
- Applet - WXS
- . net 5 Web custom middleware implementation returns the default picture
- File upload vulnerability summary and upload labs shooting range documentary
- Identificateur, mot - clé, type de données
- 2021-08-11
- 2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)
- Romantic silhouette of L2-3 of 2022 group programming ladder Simulation Competition (25 points)
猜你喜欢
2022 团体程序设计天梯赛 模拟赛 L1-7 矩阵列平移 (20 分)
Codeforces round 784 (Div. 4) (AK CF (XD) for the first time)
Unity knowledge points (ugui 2)
Identificateur, mot - clé, type de données
2022 团体程序设计天梯赛 模拟赛 L2-3 浪漫侧影 (25 分)
Idea debug debugging tutorial
C interface
对象和类的概念
Visual programming -- how to customize the mouse cursor
JS - accuracy issues
随机推荐
Three types of jump statements
2022 group programming ladder simulation l2-1 blind box packaging line (25 points)
ThreadLocal test multithreaded variable instance
Detailed description of MySQL index [B + tree index, hash index, full-text index, overlay index]
Unity basics 2
Build websocket server in. Net5 webapi
7-1 introduction to finance
Codeforces round 784 (Div. 4) (AK CF (XD) for the first time)
New ORM framework -- Introduction to beetlsql
Notes sur l'apprentissage profond (Ⅱ) - - Principe et mise en oeuvre de la fonction d'activation
The fourth operation
Batch download of files ---- compressed and then downloaded
SQL topic exercise summary
2022 group programming ladder simulation match 1-8 are prime numbers (20 points)
mui. Plusready does not take effect
2022 团体程序设计天梯赛 模拟赛 L2-4 哲哲打游戏 (25 分)
Activity supports multi window display
Use the thread factory to set the thread name in the thread pool
Application and definition of interface
Un aperçu des flux d'E / s et des opérations de fichiers de classe de fichiers