程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python+mediapipe+opencv has written a hand detection, but cant write the gesture recognition part. After reading a lot of other peoples writings, I dont understand the principle and writing method

編輯:Python
import cv2import mediapipe as melist=[]# Call the camera cap = cv2.VideoCapture(0,cv2.CAP_DSHOW)hand_recognitian = me.solutions.hands.Hands()# Check the camera while (cap.isOpened()): # Get the image of each frame of the camera ret,frame = cap.read() frame= cv2.flip(frame,1) # Convert read image format (rgb) imgs=cv2.cvtColor(frame,cv2.COLOR_BGR2RGB) result =hand_recognitian.process(imgs) # Mark 20 Coordinates of hand points and connection if result.multi_hand_landmarks: for posion in result.multi_hand_landmarks: me.solutions.drawing_utils.draw_landmarks(frame,posion,me.solutions.hands.HAND_CONNECTIONS) for id,lm in enumerate(posion.landmark): h,w,c = imgs.shape cx,cy =int(lm.x*w),int(lm.y*h) list.append([id,cx,cy]) # Display each frame image of the acquired camera cv2.imshow("handes shibie",frame) k = cv2.waitKey(1) # Press the space to enter if k==32: # Turn off camera cap.release() break

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved