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

去菲律宾做it网站开发电子商务产品有哪些

去菲律宾做it网站开发,电子商务产品有哪些,建设网证书查询,《建设监理》网站手势识别是一种人机交互技术#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://www.zqtcl.cn/news/106373/

相关文章:

  • 中小学网站建站模板长春火车站咨询电话
  • c2c网站特点公司网站建设亚运村
  • 邢台wap网站建设费用黑帽seo之搜索引擎
  • 如何用阿里云做网站刷题网站怎么做
  • 织梦制作手机网站上海猎头公司名单
  • 免费生成图片的网站wordpress 购物
  • 江西建设部网站国际新闻最新消息今天2023
  • 怎么做网站啊wordpress英文显示改中文
  • 建筑专业网站有哪些网站标题seo外包优化
  • 浙江建设厅网站施工员报名中国建设协会官网站
  • 网站建设优化是干嘛上海今天最新的新闻
  • 网站大全浏览器软文的概念
  • 盐山做网站价格莱芜征婚吧
  • 具有品牌的微网站建设网站设计培训班前台
  • 网站推广工具推荐html网站地图在线生成
  • 成都本地网站建设青岛电子商务的网站建设
  • 北京网站开发培训河南省百城建设提质工程网站
  • 郑州专业建网站南通网站建设技术支持
  • 简约网站程序网络营销方式较为单一
  • 绍兴企业自助建站123房产网
  • 科技类网站设计特点备案 网站首页地址
  • 做兼职网站网站建设培训速成
  • 开源的网站管理系统商务网站设计与建设实训
  • 东莞三合一网站制作江阴做网站的公司有
  • mvc5 网站开发之學 pdf百度搜索引擎首页
  • 手机进入网站自动识别城阳区规划建设局网站
  • 网站开发平台的公司订票网站开发公司
  • 郑州网站推广信息网架结构厂家
  • 提升网站流量的方法汕头站扩建
  • 响应式网站建设制作需要注意什么网站建设汇卓