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

专业的广州手机网站建设seo服务的内容

专业的广州手机网站建设,seo服务的内容,婚纱摄影网站建设公司,模板网站的缺点根据计算眼睛、嘴巴的变化,判断是什么表情结合以下两篇文章来理解表情识别的实现方法 基于 dilib 库的人脸检测 https://blog.csdn.net/weixin_73504499/article/details/142977202?spm1001.2014.3001.5501 基于 dlib 库的人脸关键点定位 https://blog.csdn.net/we…
  • 根据计算眼睛、嘴巴的变化,判断是什么表情
  • 结合以下两篇文章来理解表情识别的实现方法
    • 基于 dilib 库的人脸检测
      • https://blog.csdn.net/weixin_73504499/article/details/142977202?spm=1001.2014.3001.5501
    • 基于 dlib 库的人脸关键点定位
      • https://blog.csdn.net/weixin_73504499/article/details/142990867?spm=1001.2014.3001.5501
  • 完整代码如下:
    import numpy as np
    import dlib
    import cv2
    from sklearn.metrics.pairwise import euclidean_distances
    from PIL import Image, ImageDraw, ImageFont# 计算眼睛的宽高比
    def eye_aspect_ratio(eye):A = euclidean_distances(eye[1].reshape(1, 2), eye[5].reshape(1, 2))B = euclidean_distances(eye[2].reshape(1, 2), eye[4].reshape(1, 2))C = euclidean_distances(eye[0].reshape(1, 2), eye[3].reshape(1, 2))ear = ((A + B) / 2.0) / Creturn ear# 计算嘴的宽高比
    def MAR(shape):x = shape[50]y = shape[50].reshape(1, 2)A = euclidean_distances(shape[50].reshape(1, 2), shape[58].reshape(1, 2))B = euclidean_distances(shape[51].reshape(1, 2), shape[57].reshape(1, 2))C = euclidean_distances(shape[52].reshape(1, 2), shape[56].reshape(1, 2))D = euclidean_distances(shape[48].reshape(1, 2), shape[54].reshape(1, 2))return ((A + B + C) / 3) / D# 计算嘴宽度与脸颊宽度的比值
    def MJR(shape):M = euclidean_distances(shape[48].reshape(1, 2), shape[54].reshape(1, 2))  # 嘴宽度J = euclidean_distances(shape[3].reshape(1, 2), shape[13].reshape(1, 2))  # 下颌的宽度return M / J""" 向图片中添加中文 """
    def cv2AddChineseText(img, text, position, textColor=(0, 255, 0), textSize=30):if (isinstance(img, np.ndarray)):  # 判断是否是OpenCV图片类型img = Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))  # 实现 array 到 image 的转换draw = ImageDraw.Draw(img)  # 在img图片上创建一个绘图的对象# 字体的格式                       C 盘中的 Windows/Fonts 中,复制到此文件夹下可看到文件名fontStyle = ImageFont.truetype("simsun.ttc", textSize, encoding="utf-8")draw.text(position, text, textColor, font=fontStyle)  # 绘制文本return cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)  # 转换回 OpenCV 格式# 构建脸部位置检测器
    detector = dlib.get_frontal_face_detector()# 读取人脸关键点定位模型
    predictor = dlib.shape_predictor("shape_predictor_68_face_landmarks.dat")# 打开摄像头或视频
    cap = cv2.VideoCapture(0)while True:ret, frame = cap.read()frame = cv2.flip(frame, 1)faces = detector(frame, 0)  # 获取图片中全部人脸位置for face in faces:shape = predictor(frame, face)  # 获取关键点# 将关键点转换为坐标(x,y)的形式shape = np.array([[p.x, p.y] for p in shape.parts()])# 计算嘴部的高宽比mar = MAR(shape)# 计算 “最宽/脸颊宽”mjr = MJR(shape)rightEye = shape[36:42]  # 右眼,关键点索引从36到41(不包含42)leftEye = shape[42:48]  # 左眼,关键点索引从42到47(不包含48)rightEAR = eye_aspect_ratio(rightEye)  # 计算右眼纵横比leftEAR = eye_aspect_ratio(leftEye)  # 计算左眼纵横比ear = (rightEAR + leftEAR) / 2.0  # 均值处理result = "正常"  # 默认是正常表情# 打印出实际值,可以根据该值更改阈值print("mar", mar, "\tmjr", mjr, "\tear", ear)if mar > 0.5 and ear < 0.28:result = "大笑"elif mar > 0.5 and ear > 0.28:result = "愤怒"elif mjr > 0.45:result = "微笑"# 输出中文# frame = cv2AddChineseText(frame, result, (50, 100))# cv2.putText()#输出英文mouthHull = cv2.convexHull(shape[48:61])  # 嘴型构造凸包frame = cv2AddChineseText(frame, result, mouthHull[0, 0])  # 多人脸cv2.drawContours(frame, [mouthHull], -1, (0, 255, 0), 1)  # 画出凸包cv2.imshow("Frame", frame)if cv2.waitKey(1) == 27:breakcv2.destroyAllWindows()
    cap.release()
http://www.hkea.cn/news/216012/

相关文章:

  • 一个网站建设需要多少钱百度seo排名优化公司
  • 网站做app的软件友博国际个人中心登录
  • 做网站用什么代码编写可口可乐软文营销案例
  • 宜昌网站建设哪家好厦门百度广告开户
  • 网站做二级域名外链
  • 网站建设服务费属于哪个大类电商seo搜索优化
  • 12380网站建设情况的报告网络seo首页
  • 个人如何在百度上做广告网站seo什么意思
  • java做网站编程合肥seo快排扣费
  • 做律师网站公司google play下载
  • 网站怎么做详情页北京网站制作建设公司
  • 广告网站模板下载不了东莞排名优化团队
  • 网站建设人员培训纲要河北seo网络推广
  • jsp网站开发实例视频教程各大网站的网址
  • 手机网站设计要素推广竞价
  • 久久医药网seo推广培训费用
  • 网站做301顶级域名需要绑定网站排名掉了怎么恢复
  • wordpress app 源码合肥seo整站优化网站
  • 建立网站基本步骤安仁网络推广
  • 网页建设方案怎么写网站seo优化心得
  • 还没有做网站可以先备案域名吗seo怎么提升关键词的排名
  • 做网站原型图软件优化设计七年级下册语文答案
  • 2023年舆情分析报告seo优化宣传
  • 武汉网站建设 熊掌号最佳磁力引擎吧
  • 教育平台网站开发品牌运营
  • 91人才网赣州招聘网安卓优化大师app下载安装
  • 合肥网页模板建站营业推广策划
  • 网站做301根目录在哪教育培训机构平台
  • 企业做网站域名需要自己申请吗深圳百度推广客服电话多少
  • 备案网站容易被收录公司网站建设费用多少