当前位置:网站首页>Opencv recognition of face in image

Opencv recognition of face in image

2022-07-06 14:53:00 gmHappy


       
#!/usr/bin/python
#coding=utf-8

# Recognize faces in pictures
import face_recognition
jobs_image = face_recognition.load_image_file("C:/rlsb/jobs.jpg");
obama_image = face_recognition.load_image_file("C:/rlsb/obama.jpg");
unknown_image = face_recognition.load_image_file("C:/rlsb/unknown.jpg");

jobs_encoding = face_recognition.face_encodings(jobs_image)[0]
obama_encoding = face_recognition.face_encodings(obama_image)[0]
unknown_encoding = face_recognition.face_encodings(unknown_image)[0]

results = face_recognition.compare_faces([jobs_encoding, obama_encoding], unknown_encoding )
labels = ['jobs', 'obama']

print('results:'+str(results))

for i in range(0, len(results)):
if results[i] == True:
print('The person is:'+labels[i])
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.

Opencv Recognize the face in the image _ machine learning

Opencv Recognize the face in the image _ machine learning _02

test result :

       
results:[True, False]
The person is:jobs
  • 1.
  • 2.


原网站

版权声明
本文为[gmHappy]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202131335444139.html