2019-03-21 21:16:48 +08:00
2019-02-26 13:32:38 +08:00
2019-01-10 21:05:00 +08:00
2019-03-21 21:16:48 +08:00
2018-10-29 16:59:45 +08:00
2019-02-26 13:32:38 +08:00

Face recognition from camera
############################

Introduction
************

Detect and recognize single/multi-faces from camera;

调用摄像头进行人脸识别,支持多张人脸同时识别;


#. 摄像头人脸录入 / Face register

   .. image:: introduction/get_face_from_camera.png
      :align: center

#. 提取特征建立人脸数据库 / Generate database from images captured
#. 利用摄像头进行人脸识别 / Face recognizer
   
   当单张人脸 / When single-face:
   
   .. image:: introduction/face_reco_single_person.png
      :align: center

   当多张人脸 / When multi-faces:
   
   .. image:: introduction/face_reco_two_people.png
      :align: center

** 关于精度 / About accuracy:

* When using a distance threshold of ``0.6``, the dlib model obtains an accuracy of ``99.38%`` on the standard LFW face recognition benchmark.


Steps
*****

#. 进行 face register / 人脸信息采集录入

   .. code-block:: python

      python3 get_face_from_camera.py

#. 提取所有录入人脸数据存入 features_all.csv

   .. code-block:: python

      python3 get_features_into_CSV.py

#. 调用摄像头进行实时人脸识别

   .. code-block:: python

      python3 face_reco_from_camera.py


About Source Code
*****************

Python 源码介绍如下:

#. get_face_from_camera.py: 

   进行 Face register / 人脸信息采集录入

   * 请注意存储人脸图片时,矩形框不要超出摄像头范围,要不然无法保存到本地;
   * 超出会有 "out of range" 的提醒;


#. get_features_into_CSV.py: 
     
   从上一步存下来的图像文件中,提取人脸数据存入CSV;
  
   * 会生成一个存储所有特征人脸数据的 "features_all.csv";
   * size: n*128 , n means n people you registered and 128 means 128D features of the face


#. face_reco_from_camera.py: 

   这一步将调用摄像头进行实时人脸识别; / This part will implement real-time face recognition;
  
   * Compare the faces captured from camera with the faces you have registered which are saved in "features_all.csv"
   
   * 将捕获到的人脸数据和之前存的人脸数据进行对比计算欧式距离, 由此判断是否是同一个人;


More
****

Tips:

1. Windows下建议不要把代码放到 ``C:\``, 可能会出现权限读取问题

2. 代码最好不要有中文路径

3. 人脸录入的时候先建文件夹再保存图片, 先 ``N`` 再 ``S``

For more details, please refer to my blog (in chinese) or mail to me /

可以访问我的博客获取本项目的更详细介绍,如有问题可以邮件联系我:

* Blog: https://www.cnblogs.com/AdaminXie/p/9010298.html
  
* Mail: coneypo@foxmail.com


仅限于交流学习, 商业合作勿扰;

Thanks for your support.
Description
Languages
PureBasic 92.2%
Python 7.8%