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

建设网站的服务费是指什么百度账户托管运营

建设网站的服务费是指什么,百度账户托管运营,公司介绍怎么写范本,建站收费标准手势识别是一种人机交互技术#xff0c;通过识别人的手势动作#xff0c;从而实现对计算机、智能手机、智能电视等设备的操作和控制。 1. opencv实现手部追踪#xff08;定位手部关键点#xff09; 2.opencv实战项目 实现手势跟踪并返回位置信息#xff08;封装调用通过识别人的手势动作从而实现对计算机、智能手机、智能电视等设备的操作和控制。 1.  opencv实现手部追踪定位手部关键点 2.opencv实战项目 实现手势跟踪并返回位置信息封装调用 3.opencv实战项目 手势识别-手势控制鼠标 4.opencv实战项目 手势识别-手势控制键盘 未完待续 本专栏记录作者的学习之旅会一直更新下去欢迎订阅一起学习进步 本项目是使用了谷歌开源的框架mediapipe里面有非常多的模型提供给我们使用例如面部检测身体检测手部检测等 代码需要用到opencv   HandTraqckModule模块   mediapipe模块和一个键盘控制模块pynputcvzone模块 一、HandTraqckModule模块  前面的文章中有封装手部检测模块的教程这边简单的介绍一下有新增加的模块可以简单学习一下 import cv2 import mediapipe as mp import mathclass HandDetector:Finds Hands using the mediapipe library. Exports the landmarksin pixel format. Adds extra functionalities like finding howmany fingers are up or the distance between two fingers. Alsoprovides bounding box info of the hand found.def __init__(self, modeFalse, maxHands2, detectionCon0.5, minTrackCon0.5)::param mode: In static mode, detection is done on each image: slower:param maxHands: Maximum number of hands to detect:param detectionCon: Minimum Detection Confidence Threshold:param minTrackCon: Minimum Tracking Confidence Thresholdself.mode modeself.maxHands maxHandsself.detectionCon detectionConself.minTrackCon minTrackConself.mpHands mp.solutions.handsself.hands self.mpHands.Hands(self.mode, self.maxHands,self.detectionCon, self.minTrackCon)self.mpDraw mp.solutions.drawing_utilsself.tipIds [4, 8, 12, 16, 20]self.fingers []self.lmList []def findHands(self, img, drawTrue):Finds hands in a BGR image.:param img: Image to find the hands in.:param draw: Flag to draw the output on the image.:return: Image with or without drawingsimgRGB cv2.cvtColor(img, cv2.COLOR_BGR2RGB)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, handNo0, drawTrue):Finds landmarks of a single hand and puts them in a listin pixel format. Also finds the bounding box around the hand.:param img: main image to find hand in:param handNo: hand id if more than one hand detected:param draw: Flag to draw the output on the image.:return: list of landmarks in pixel format; bounding boxxList []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):Finds how many fingers are open and returns in a list.Considers left and right hands separately:return: List of which fingers are upif 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 findDistance(self, p1, p2, img, drawTrue):Find the distance between two landmarks based on theirindex numbers.:param p1: Point1 - Index of Landmark 1.:param p2: Point2 - Index of Landmark 2.:param img: Image to draw on.:param draw: Flag to draw the output on the image.:return: Distance between the pointsImage with output drawnLine informationif self.results.multi_hand_landmarks:x1, y1 self.lmList[p1][0], self.lmList[p1][1]x2, y2 self.lmList[p2][0], self.lmList[p2][1]cx, cy (x1 x2) // 2, (y1 y2) // 2if draw:cv2.circle(img, (x1, y1), 15, (255, 0, 255), cv2.FILLED)cv2.circle(img, (x2, y2), 15, (255, 0, 255), cv2.FILLED)cv2.line(img, (x1, y1), (x2, y2), (255, 0, 255), 3)cv2.circle(img, (cx, cy), 15, (255, 0, 255), cv2.FILLED)length math.hypot(x2 - x1, y2 - y1)return length, img, [x1, y1, x2, y2, cx, cy]def handType(self):Checks if the hand is left or right:return: Right or Leftif self.results.multi_hand_landmarks:if self.lmList[17][0] self.lmList[5][0]:return Rightelse:return Leftdef main():cap cv2.VideoCapture(0)detector HandDetector(detectionCon0.8, maxHands1)while True:# Get image framesuccess, img cap.read()# Find the hand and its landmarksimg detector.findHands(img)lmList, bboxInfo detector.findPosition(img)print(detector.handType())# Displaycv2.imshow(Image, img)cv2.waitKey(1)if __name__ __main__:main() 导入库导入了必要的库包括 OpenCV (cv2) 用于图像处理和显示Mediapipe (mediapipe) 用于手部检测和跟踪以及数学库 (math)。 HandDetector 类这是主要的手势检测器类提供了多个方法来处理手部检测和分析手势。 __init__ 方法初始化检测器的参数例如检测模式、最大检测手数、检测和跟踪的置信度阈值等。 findHands 方法在给定的图像中寻找手部可以选择是否绘制检测结果。 findPosition 方法找到单个手部的关键点位置landmarks并将它们存储在像素格式的列表中同时计算手部的边界框信息。 fingersUp 方法确定手势中有多少个手指打开将结果以列表形式返回。 findDistance 方法计算两个指定关键点之间的距离并在图像上绘制结果。 handType 方法确定手的类型是左手还是右手。 具体就不展开讲了 这个函数在有一个专门的包叫做cvzone里有但是不知道是不是版本的问题少了一些东西运行不起来只能自己手撸检测模块。 下面是主函数的代码 import cv2 from cvzone.HandTrackingModule import HandDetector from HandTrackingModule import * from time import sleep import numpy as np import cvzone from pynput.keyboard import Controllercap cv2.VideoCapture(0) cap.set(3, 1280) cap.set(4, 720)detector HandDetector(detectionCon0.5) keys [[Q, W, E, R, T, Y, U, I, O, P],[A, S, D, F, G, H, J, K, L, ;],[Z, X, C, V, B, N, M, ,, ., /]] finalText keyboard Controller()def drawAll(img, buttonList):for button in buttonList:x, y button.posw, h button.sizecvzone.cornerRect(img, (button.pos[0], button.pos[1], button.size[0], button.size[1]),20, rt0)cv2.rectangle(img, button.pos, (x w, y h), (255, 0, 255), cv2.FILLED)cv2.putText(img, button.text, (x 20, y 65),cv2.FONT_HERSHEY_PLAIN, 4, (255, 255, 255), 4)return img# # def drawAll(img, buttonList): # imgNew np.zeros_like(img, np.uint8) # for button in buttonList: # x, y button.pos # cvzone.cornerRect(imgNew, (button.pos[0], button.pZXos[1], button.size[0], button.size[1]), # 20, rt0) # cv2.rectangle(imgNew, button.pos, (x button.size[0], y button.size[1]), # (255, 0, 255), cv2.FILLED) # cv2.putText(imgNew, button.text, (x 40, y 60), # cv2.FONT_HERSHEY_PLAIN, 2, (255, 255, 255), 3) # # out img.copy() # alpha 0.5 # mask imgNew.astype(bool) # print(mask.shape) # out[mask] cv2.addWeighted(img, alpha, imgNew, 1 - alpha, 0)[mask] # return outclass Button():def __init__(self, pos, text, size[85, 85]):self.pos posself.size sizeself.text textbuttonList [] for i in range(len(keys)):for j, key in enumerate(keys[i]):buttonList.append(Button([100 * j 50, 100 * i 50], key))while True:success, img cap.read()img detector.findHands(img)lmList, bboxInfo detector.findPosition(img)img drawAll(img, buttonList)if lmList:for button in buttonList:x, y button.posw, h button.sizeif x lmList[8][0] x w and y lmList[8][1] y h:cv2.rectangle(img, (x - 5, y - 5), (x w 5, y h 5), (175, 0, 175), cv2.FILLED)cv2.putText(img, button.text, (x 20, y 65),cv2.FONT_HERSHEY_PLAIN, 4, (255, 255, 255), 4)l, _, _ detector.findDistance(8, 12, img, drawFalse)print(l)## when clickedif l 30:keyboard.press(button.text)cv2.rectangle(img, button.pos, (x w, y h), (0, 255, 0), cv2.FILLED)cv2.putText(img, button.text, (x 20, y 65),cv2.FONT_HERSHEY_PLAIN, 4, (255, 255, 255), 4)finalText button.textsleep(0.15)cv2.rectangle(img, (50, 350), (700, 450), (175, 0, 175), cv2.FILLED)cv2.putText(img, finalText, (60, 430),cv2.FONT_HERSHEY_PLAIN, 5, (255, 255, 255), 5)cv2.imshow(Image, img)cv2.waitKey(1)导入库导入了需要的库包括 OpenCV (cv2) 用于图像处理和显示Mediapipe 中的 HandDetector 用于手部检测cvzone 用于绘制按钮外观numpy 用于数组处理pynput.keyboard 中的 Controller 用于模拟键盘输入time 用于延时。 设置摄像头参数通过 OpenCV 设置摄像头的分辨率为 1280x720。 创建 HandDetector 实例使用 HandDetector 类创建一个手势检测器实例设置检测的置信度阈值为 0.5。 创建按钮列表创建了一个包含虚拟键盘按钮信息的列表按键布局通过嵌套列表 keys 定义。 创建 Button 类用于创建虚拟按钮的类每个按钮包含位置、文本内容和大小。 主循环进入一个无限循环用于处理实时的摄像头捕获图像帧。 读取图像帧从摄像头捕获图像帧。 手部检测使用手势检测器找出图像中的手部和关键点。 绘制按钮调用 drawAll 函数在图像上绘制虚拟按钮。 遍历按钮列表对每个按钮进行检查看是否有手指触摸到按钮。 如果手指在按钮范围内绘制高亮效果。 计算手指触摸点与按钮中心的距离如果小于一定阈值则模拟键盘按下并记录输入。 绘制已输入的文本在图像上绘制已输入的文本。 显示图像通过 OpenCV 显示处理后的图像。 等待键盘输入等待 1 毫秒以便保持图像窗口的响应性。 运行主程序执行主循环处理实时的摄像头捕获和手势识别。 如果有遇到问题可以评论区留言大家一起相互学习
http://wiki.neutronadmin.com/news/36799/

相关文章:

  • 菜鸟教程网站是怎么做的外卖网站怎么做销量
  • 电子政务网站开发小企业建站系统
  • 中山市中国建设银行网站300个好听的公司名字大全
  • 网站建设文献英文如何建设网站地图
  • 建设网站服务器 知乎WordPress调用外链
  • 个人网站服务器推荐建设网站实训收获
  • 少儿编程加盟店倒闭温州英文seo
  • 提供大良营销网站建设免费com域名网站
  • 文创设计网站怎样增加网站流量
  • 制作网站编程公众号二次开发
  • 中国建设银行行网站九江企业网站建设
  • 电商网站有哪些使用场景哪个厂家的广州网站建设
  • 网站开发前端制作网站推广软件信息
  • 重庆茶叶网站建设平台类网站做多久
  • 网站开发主框架一般用什么布局网站建设caiyiduo
  • 模板演示网站一线品牌全屋定制排名
  • 建大型购物网站wordpress demo iframe
  • 群晖做网站建设工程的招标网站有哪些
  • 做项目的编程网站平台网站模板素材图片下载
  • 宁波建网站费用哪里找专业做网站的人
  • 电商网站优化方案百度点击工具
  • 网站仿站大多少钱怎么进行网站诊断
  • 网站被网站建设的人控制了外国知名个人网站
  • 个人备案网站名称大全月夜影院
  • 建设企业网站企业网上银行登录网站流量统计主要指标包括
  • 织梦素材网站模板重庆外贸网站建设公司排名
  • 手机微网站尺寸seo营销是指
  • 网站建设 聊城信息港删除网站栏目
  • 网站建设重点是什么网站建设服务费会计分录
  • 雅安城乡住房建设厅网站浏览wap网站