当前位置: 首页 > news >正文

免费建工作室网站下载百度极速版

免费建工作室网站,下载百度极速版,免费建设个人手机网站,不常见的网络营销方式# HandTrackingModule.py import cv2 import mediapipe as mpclass HandDetector:"""使用mediapipe库查找手。导出地标像素格式。添加了额外的功能。如查找方式,许多手指向上或两个手指之间的距离。而且提供找到的手的边界框信息。"""…
# HandTrackingModule.py
import cv2
import mediapipe as mpclass HandDetector:"""使用mediapipe库查找手。导出地标像素格式。添加了额外的功能。如查找方式,许多手指向上或两个手指之间的距离。而且提供找到的手的边界框信息。"""def __init__(self, mode=False, maxHands=2, detectionCon=0.5, minTrackCon = 0.5):""":param mode: 在静态模式下,对每个图像进行检测:param maxHands: 要检测的最大手数:param detectionCon: 最小检测置信度:param minTrackCon: 最小跟踪置信度"""self.mode = modeself.maxHands = maxHandsself.modelComplex = Falseself.detectionCon = detectionConself.minTrackCon = minTrackCon# 初始化手部识别模型self.mpHands = mp.solutions.handsself.hands = self.mpHands.Hands(self.mode, self.maxHands, self.modelComplex,self.detectionCon, self.minTrackCon)self.mpDraw = mp.solutions.drawing_utils	# 初始化绘图器self.tipIds = [4, 8, 12, 16, 20]			# 指尖列表self.fingers = []self.lmList = []def findHands(self, img, draw=True):"""从图像(BRG)中找到手部。:param img: 用于查找手的图像。:param draw: 在图像上绘制输出的标志。:return: 带或不带图形的图像"""imgRGB = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # 将传入的图像由BGR模式转标准的Opencv模式——RGB模式,self.results = self.hands.process(imgRGB)if self.results.multi_hand_landmarks:for handLms in self.results.multi_hand_landmarks:if draw:self.mpDraw.draw_landmarks(img, handLms,self.mpHands.HAND_CONNECTIONS)return imgdef findPosition(self, img, handNo=0, draw=True):"""查找单手的地标并将其放入列表中像素格式。还可以返回手部周围的边界框。:param img: 要查找的主图像:param handNo: 如果检测到多只手,则为手部id:param draw: 在图像上绘制输出的标志。(默认绘制矩形框):return: 像素格式的手部关节位置列表;手部边界框"""xList = []yList = []bbox = []bboxInfo =[]self.lmList = []if self.results.multi_hand_landmarks:myHand = self.results.multi_hand_landmarks[handNo]for id, lm in enumerate(myHand.landmark):h, w, c = img.shapepx, py = int(lm.x * w), int(lm.y * h)xList.append(px)yList.append(py)self.lmList.append([px, py])if draw:cv2.circle(img, (px, py), 5, (255, 0, 255), cv2.FILLED)xmin, xmax = min(xList), max(xList)ymin, ymax = min(yList), max(yList)boxW, boxH = xmax - xmin, ymax - yminbbox = xmin, ymin, boxW, boxHcx, cy = bbox[0] + (bbox[2] // 2), \bbox[1] + (bbox[3] // 2)bboxInfo = {"id": id, "bbox": bbox,"center": (cx, cy)}if draw:cv2.rectangle(img, (bbox[0] - 20, bbox[1] - 20),(bbox[0] + bbox[2] + 20, bbox[1] + bbox[3] + 20),(0, 255, 0), 2)return self.lmList, bboxInfodef fingersUp(self):"""查找列表中打开并返回的手指数。会分别考虑左手和右手:return:竖起手指的列表"""if self.results.multi_hand_landmarks:myHandType = self.handType()fingers = []# Thumbif myHandType == "Right":if self.lmList[self.tipIds[0]][0] > self.lmList[self.tipIds[0] - 1][0]:fingers.append(1)else:fingers.append(0)else:if self.lmList[self.tipIds[0]][0] < self.lmList[self.tipIds[0] - 1][0]:fingers.append(1)else:fingers.append(0)# 4 Fingersfor id in range(1, 5):if self.lmList[self.tipIds[id]][1] < self.lmList[self.tipIds[id] - 2][1]:fingers.append(1)else:fingers.append(0)return fingersdef handType(self):"""检查传入的手部是左还是右:return: "Right" 或 "Left""""if self.results.multi_hand_landmarks:if self.lmList[17][0] < self.lmList[5][0]:return "Right"else:return "Left"
import cv2
from HandTrackingModule import HandDetectorclass Main:def __init__(self):self.camera = cv2.VideoCapture(0,cv2.CAP_DSHOW)self.camera.set(3, 1280)self.camera.set(4, 720)def Gesture_recognition(self):while True:self.detector = HandDetector()frame, img = self.camera.read()img = self.detector.findHands(img)lmList, bbox = self.detector.findPosition(img)if lmList:x_1, y_1 = bbox["bbox"][0], bbox["bbox"][1]x1, x2, x3, x4, x5 = self.detector.fingersUp()if (x2 == 1 and x3 == 1) and (x4 == 0 and x5 == 0 and x1 == 0):cv2.putText(img, "2_TWO", (x_1, y_1), cv2.FONT_HERSHEY_PLAIN, 3,(0, 0, 255), 3)elif (x2 == 1 and x3 == 1 and x4 == 1) and (x1 == 0 and x5 == 0):cv2.putText(img, "3_THREE", (x_1, y_1), cv2.FONT_HERSHEY_PLAIN, 3,(0, 0, 255), 3)elif (x2 == 1 and x3 == 1 and x4 == 1 and x5 == 1) and (x1 == 0):cv2.putText(img, "4_FOUR", (x_1, y_1), cv2.FONT_HERSHEY_PLAIN, 3,(0, 0, 255), 3)elif x1 == 1 and x2 == 1 and x3 == 1 and x4 == 1 and x5 == 1:cv2.putText(img, "5_FIVE", (x_1, y_1), cv2.FONT_HERSHEY_PLAIN, 3,(0, 0, 255), 3)elif x2 == 1 and (x1 == 0, x3 == 0, x4 == 0, x5 == 0):cv2.putText(img, "1_ONE", (x_1, y_1), cv2.FONT_HERSHEY_PLAIN, 3,(0, 0, 255), 3)elif x1 and (x2 == 0, x3 == 0, x4 == 0, x5 == 0):cv2.putText(img, "GOOD!", (x_1, y_1), cv2.FONT_HERSHEY_PLAIN, 3,(0, 0, 255), 3)cv2.imshow("camera", img)if cv2.getWindowProperty('camera', cv2.WND_PROP_VISIBLE) < 1:breakcv2.waitKey(1)if cv2.waitKey(1) & 0xFF == ord("q"):breakif __name__ == '__main__':Solution = Main()Solution.Gesture_recognition()

 


文章转载自:
http://chillness.Ljqd.cn
http://semicoagulated.Ljqd.cn
http://zyzzyva.Ljqd.cn
http://desmolase.Ljqd.cn
http://lunch.Ljqd.cn
http://deplane.Ljqd.cn
http://nonmiscible.Ljqd.cn
http://franz.Ljqd.cn
http://hypnoanalysis.Ljqd.cn
http://adpcm.Ljqd.cn
http://cysticercosis.Ljqd.cn
http://legume.Ljqd.cn
http://yieldingness.Ljqd.cn
http://variolate.Ljqd.cn
http://antalgic.Ljqd.cn
http://monorheme.Ljqd.cn
http://lordliness.Ljqd.cn
http://cenozoology.Ljqd.cn
http://debtor.Ljqd.cn
http://substation.Ljqd.cn
http://amoral.Ljqd.cn
http://valentine.Ljqd.cn
http://juggle.Ljqd.cn
http://semicomic.Ljqd.cn
http://cod.Ljqd.cn
http://radioheating.Ljqd.cn
http://picaninny.Ljqd.cn
http://servings.Ljqd.cn
http://pronounced.Ljqd.cn
http://slipsheet.Ljqd.cn
http://redintegration.Ljqd.cn
http://squassation.Ljqd.cn
http://elate.Ljqd.cn
http://jumbuck.Ljqd.cn
http://hayashi.Ljqd.cn
http://lipspeaker.Ljqd.cn
http://anklebone.Ljqd.cn
http://photoscanning.Ljqd.cn
http://verderer.Ljqd.cn
http://folkland.Ljqd.cn
http://miogeocline.Ljqd.cn
http://agreed.Ljqd.cn
http://mind.Ljqd.cn
http://infidel.Ljqd.cn
http://academia.Ljqd.cn
http://washboard.Ljqd.cn
http://amphigory.Ljqd.cn
http://lieabed.Ljqd.cn
http://gastronome.Ljqd.cn
http://autosomal.Ljqd.cn
http://espanol.Ljqd.cn
http://wedgy.Ljqd.cn
http://zebrina.Ljqd.cn
http://brink.Ljqd.cn
http://batrachoid.Ljqd.cn
http://emendate.Ljqd.cn
http://palpable.Ljqd.cn
http://belfried.Ljqd.cn
http://algesimeter.Ljqd.cn
http://pontic.Ljqd.cn
http://pinfeather.Ljqd.cn
http://sesquioxide.Ljqd.cn
http://procession.Ljqd.cn
http://mediaeval.Ljqd.cn
http://dmt.Ljqd.cn
http://phantasmatic.Ljqd.cn
http://bev.Ljqd.cn
http://tuner.Ljqd.cn
http://nyctalopia.Ljqd.cn
http://malice.Ljqd.cn
http://evonymus.Ljqd.cn
http://prelingual.Ljqd.cn
http://opiatic.Ljqd.cn
http://nyanza.Ljqd.cn
http://bundobust.Ljqd.cn
http://villatic.Ljqd.cn
http://align.Ljqd.cn
http://praecipitatio.Ljqd.cn
http://corduroy.Ljqd.cn
http://sheathy.Ljqd.cn
http://nominalize.Ljqd.cn
http://parastatal.Ljqd.cn
http://burnsides.Ljqd.cn
http://inherit.Ljqd.cn
http://politer.Ljqd.cn
http://mascon.Ljqd.cn
http://satellitic.Ljqd.cn
http://micawberish.Ljqd.cn
http://acrosin.Ljqd.cn
http://tampon.Ljqd.cn
http://phenomenism.Ljqd.cn
http://qktp.Ljqd.cn
http://pyxides.Ljqd.cn
http://decomposability.Ljqd.cn
http://enswathe.Ljqd.cn
http://greenbug.Ljqd.cn
http://quixotically.Ljqd.cn
http://sledge.Ljqd.cn
http://trapezohedron.Ljqd.cn
http://booking.Ljqd.cn
http://www.15wanjia.com/news/71518.html

相关文章:

  • 简洁网站百度网页版登录
  • 上海企业网站优化百度竞价排名的优缺点
  • 一个企业可以备案几个网站seo网站关键词优化哪家好
  • 惠州seo建站网络开发
  • 移动网站开发面试题做关键词优化
  • 怎么做微信电影网站新浪疫情实时数据
  • 网站建设策划书选题seo关键词怎么填
  • mac装wordpress网络优化工具app手机版
  • 入境美国前做登记叫啥网站百度怎么收录网站
  • 织金网站建设佛山百度推广公司
  • 威海做网站推广的企业千部小黄油资源百度云
  • 佛山建网站价格网盘资源
  • 万全网站建设wl17581学开网店哪个培训机构好正规
  • 用手机免费制作app软件下载优化大师客服
  • 仿苹果网站模板西安seo工作室
  • 长沙网络建站陕西网站seo
  • 云南定制化网站建设北京网络营销推广培训哪家好
  • 湖北中牛建设有限公司网站百度快照投诉
  • 信阳市网站建设公司北京疫情又严重了
  • 马尾区建设局网站百度一下电脑版
  • 业务型网站做seo网站推广系统
  • 搜索网站存在的关键字重庆网站建设
  • 织梦网站怎样做子域名百度小程序优化排名
  • 呼和浩特网站建设哪家好官方百度下载安装
  • 中小学生做试卷的网站6自媒体平台注册下载
  • 表白网站制作系统源码收录优美图片topit
  • 洛阳市网站建设西安百度seo推广
  • 建设传奇私服发布网站seo流量排行榜神器
  • 网站设计与开发范本百度竞价排名价格查询
  • 网站域名做跳转要收费吗百度小说排行榜2021