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)

  

python face_recognition模块实现人脸识别的更多相关文章

  1. 基于Python的face_recognition库实现人脸识别

    一.face_recognition库简介 face_recognition是Python的一个开源人脸识别库,支持Python 3.3+和Python 2.7.引用官网介绍: Recognize a ...

  2. 10分钟手把手教你运用Python实现简单的人脸识别

    欲直接下载代码文件,关注我们的公众号哦!查看历史消息即可! 前言:让我的电脑认识我 我的电脑只有认识我,才配称之为我的电脑! 今天,我们用Python实现高大上的人脸识别技术! Python里,简单的 ...

  3. python三步实现人脸识别

    原文地址https://www.toutiao.com/a6475797999176417550 Face Recognition软件包 这是世界上最简单的人脸识别库了.你可以通过Python引用或者 ...

  4. Python Face Recognition 实现人脸识别

    一.Face Recognition软件包 我们的人脸识别基于face_recognition库.face_recognition基于dlib实现,用深度学习训练数据,模型准确率高达99.38%. 人 ...

  5. 基于Python与命令行人脸识别项目(系列二)

    接着系统一,继续开始我们face_recognition. Python 模块:face_recognition 在Python中,你可以导入face_recognition模块,调用丰富的API接口 ...

  6. 基于Python与命令行人脸识别项目(系列一)

    Face Recognition 人脸识别 摘要:本项目face_recognition是一个强大.简单.易上手的人脸识别开源项目,并且配备了完整的开发文档和应用案例,方便大家使用.对于本项目可以使用 ...

  7. python之OpenCv(四)---人脸识别

    对特定图像进行识别,最关键的是要有识别对象的特征文件.OpenCV已经内置了人脸识别特征文件,我们只要使用OpenCV的CascadeClassifier类即可进行识别. 语法: https://gi ...

  8. python基于OpenCV的人脸识别系统

    想获得所有的代码,请下载(来自我的CSDN): https://download.csdn.net/download/qq_40875849/11292912 主函数: from recognitio ...

  9. python+opencv+Face++实现人脸识别比对

    2018-03-2010:16:55 代码仓库--GitHub--https://github.com/az666/python_opencv_face- 依旧是先来图片 下面这张是我进行识别的效果( ...

随机推荐

  1. (线段树 -星星等级)Stars POJ - 2352

    题意: 给出n个星星的坐标 x,y ,当存在其他星星的坐标x1,y1满足x>=x1&&y>=y1时 这个星星的等级就加1. 注意: 题中给的数据是有规律的 ,y是逐渐增加的 ...

  2. Python python 函数参数:关键字参数

    # 关键字参数 '''关键字参数代表传入任意个含参数名的参数,这些关键字参数在函数内部自动组装为一个dict ''' def student(name,sex,**keywords): print(' ...

  3. Mac word文档的消失问题以及解决方案

    最近用mac电脑上的Microsoft Word写文档时,出现一个很奇怪的现象:明明我已经保存了文档到某个目录下,但是当我退出Word后,准备去保存目录找文档时发现文档消失了,前一秒还在!!! 通过各 ...

  4. MATLAB 文件读取(3)

    1.gps ,数值格式的读取 clear all test=importdata('2017- 9-27- 8-26-51.txt'); [r,c]=size(test.data);%row行,col ...

  5. C#是什么?

    C# 是一个现代的.通用的.面向对象的编程语言,它是由微软(Microsoft)开发的,由 Ecma 和 ISO 核准认可的. C# 是由 Anders Hejlsberg 和他的团队在 .Net 框 ...

  6. SQL Server中STATISTICS IO物理读和逻辑读的误区

    SQL Server中STATISTICS IO物理读和逻辑读的误区 大家知道,SQL Server中可以利用下面命令查看某个语句读写IO的情况 SET STATISTICS IO ON 那么这个命令 ...

  7. mysql清空表后id重1开始

    通过"truncate table 表名"方式重置清空id,让id从1开始自动递增,

  8. 1050 String Subtraction (20分)

    Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking ...

  9. 【php】LAMP中开启错误提示

    vi /usr/local/php/etc/php.ini 查找display_errors 开启On即可

  10. mysql 聚集函数 count 使用详解

    mysql 聚集函数 count 使用详解 本文将探讨以下问题 1.count(*) . count(n).count(null)与count(fieldName) 2.distinct 与 coun ...