MediaPipe + OpenCV五分钟搞定手势识别

mediapipe介绍
这个是真的,首先需要从google在2020年发布的mediapipe开发包说起,这个开发包集成了人脸、眼睛、虹膜、手势、姿态等各种landmark检测与跟踪算法。
https://google.github.io/mediapipe/ 请看下图比较详细
是个不折不扣的现实增强的宝藏工具包,特别实用!支持的平台跟语言也非常的丰富,图示如下:
只说一遍,感觉要逆天了,依赖库只有一个就是opencv,python版本的安装特别简单,直接运行下面的命令行:
pip install mediapipe
手势landmark检测
直接运行官方提供的python演示程序,需要稍微修改一下,因为版本更新了,演示程序有点问题,改完之后执行运行视频测试,完美get到手势landmark关键点:
手势landmark的关键点编号与解释如下:
修改后的代码如下:
import cv2import mediapipe as mpmp_drawing = mp.solutions.drawing_utilsmp_hands = mp.solutions.hands# for webcam input:cap = cv2.videocapture(0)with mp_hands.hands(    min_detection_confidence=0.5,    min_tracking_confidence=0.5) as hands:  while cap.isopened():    success, image = cap.read()    if not success:      print(ignoring empty camera frame.)      # if loading a video, use 'break' instead of 'continue'.      continue    # to improve performance, optionally mark the image as not writeable to    # pass by reference.    image.flags.writeable = false    image = cv2.cvtcolor(image, cv2.color_bgr2rgb)    results = hands.process(image)    # draw the hand annotations on the image.    image.flags.writeable = true    image = cv2.cvtcolor(image, cv2.color_rgb2bgr)    if results.multi_hand_landmarks:      for hand_landmarks in results.multi_hand_landmarks:        mp_drawing.draw_landmarks(            image,            hand_landmarks,            mp_hands.hand_connections)        cv2.imwrite('d:/result.png', cv2.flip(image, 1))    # flip the image horizontally for a selfie-view display.    cv2.imshow('mediapipe hands', cv2.flip(image, 1))    if cv2.waitkey(5) & 0xff == 27:      breakcap.release()  
手势识别
基于最简单的图象分类,收集了几百张图象,做了一个简单的迁移学习,实现了三种手势分类,运行请看视频:

泰克Sentry解决方案再获两项业内大奖
安规陶瓷电容是陶瓷电容吗?
从这三个维度看智能LED的发展
虚拟币交易平台源码开发,虚拟币合约期货平台
电气设计常用的4种接地方式
MediaPipe + OpenCV五分钟搞定手势识别
虚焊和假焊的原因是什么?自动焊锡机虚焊和假焊怎么解决
UVLED(紫外LED)会在未来工业生产中扮演重要角色
Vishay Siliconix发布用于功率MOSFET的免费在线仿真工具
英国在华为参与5G网络建设上的态度,已经变得强硬
四芯CMOS模拟IC-RS2268,四通道模拟开关 单刀单掷300MHz
iphone8什么时候上市?最新消息:iphone8、iphone7s即将发布,iphone 8外形确定,价格突破1000美元,还有新专利!
阳光照明:国内照明行业的领导者
USBC口5V输入四节串联锂电池充电管理芯片
供需两端回暖 3月份PMI重回荣枯线以上
红外测温仪为什么会测不准_原因有哪些
新时代的智慧城市,都在哪些层面上发生变化?
光学传感器模块在烟雾报警器的应用方案
过去的时间人工智能是如何改变我们的生活的
手机锂电池的组成以及弹片微针模组的应用