精确人脸识别
import face_recognition
import cv2
import matplotlib.pyplot as plt
image = face_recognition.load_image_file("D:\Python 32\Lib\site-packages\cv2\data\img\old.jpg")
face_locations=face_recognition.face_locations(image)
face_num2=len(face_locations)
print(face_num2)
org = cv2.imread("D:\Python 32\Lib\site-packages\cv2\data\img\old.jpg")
for i in range(0,face_num2):
top = face_locations[i][0]
right = face_locations[i][1]
bottom = face_locations[i][2]
left = face_locations[i][3]
start = (left, top)
end = (right, bottom)
color = (30,155,255)
thickness = 5
img=cv2.rectangle(org, start, end, color, thickness)
plt.imshow(img)
plt.axis('off')
plt.show()