import face_recognition  #人脸识别库  pip cmake dlib
import cv2 #读取图像
face_image1 = face_recognition.load_image_file("1.jpg")
face_image2 = face_recognition.load_image_file("2.jpg")
# print(face_image) face_encoding1 = face_recognition.face_encodings(face_image1)
face_encoding2 = face_recognition.face_encodings(face_image2)
face_location1 = face_recognition.face_locations(face_image1)
face_location2 = face_recognition.face_locations(face_image2)
# print(face_encoding1,face_encoding2) results= face_recognition.compare_faces([face_encoding1[0]],face_encoding2[0],tolerance=0.5)
# print(results)
top,right,bottom,left = face_location2[0]
cv2.rectangle(face_image2,(left,top),(right,bottom),(0,255,0),2)
cv2.putText(face_image2,"xinyuuliu",(left-10,top-10),cv2.FONT_HERSHEY_SIMPLEX,0.8,(255,0,0),2)
#绘图 face_image_rgb = cv2.cvtColor(face_image2,cv2.COLOR_BGR2RGB) cv2.imshow("Output",face_image_rgb)
cv2.imwrite("result.jpg",face_image_rgb,[int(cv2.IMWRITE_JPEG_QUALITY),100])
cv2.waitKey(0)

  

最新文章

  1. [Erlang 0111] Erlang Abstract Format , Part 2
  2. Java多线程之构造与发布
  3. BZOJ AC800纪念
  4. Apache安装与属性配置
  5. 【leetcode】Maximum Gap(hard)★
  6. Codeforces Round #248 (Div. 2) C. Ryouko's Memory Note
  7. js 正则 以字母开头必须有 大小写字母数字组成 可以有“@"或 ”.“
  8. hdu 4832 Chess(dp)
  9. C++基础内容复习
  10. NSQ:分布式的实时消息平台
  11. Maven中Spring-Data-Redis存储对象(redisTemplate)
  12. ajax 本地测试,使用Chrome 浏览器
  13. ZigBee心电传输(三)
  14. 流风ASP.NET框架商业版-工作流1.0简介
  15. 2018.4.16Spring.Net入门学习内容
  16. Eclipse中如何将项目转成Dynamic Web项目
  17. android SeekBar设置背景无法被填充满的bug
  18. [模板][P3377]左偏树
  19. Android系统备忘1
  20. System V 消息队列 实例

热门文章

  1. JSP+Servlet+C3P0+Mysql实现的简单新闻系统
  2. Java中如何调用静态方法
  3. Markdown语法快速学习
  4. MySQL:锁机制和隔离事务级别
  5. Matlab——m_map指南(3)——实例
  6. Validation框架的应用
  7. UnboundLocalError,探讨Python中的绑定
  8. 1049 Counting Ones (30分)
  9. 1028 List Sorting (25 分)
  10. Windows 手动安装 Apache24 web服务器