import face_recognition import cv2 image = face_recognition.load_image_file("face2.jpg") face_locations = face_recognition.face_locations(image) facenum = len(face_locations) for i in range(0, facenum): 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 = (0, 0, 255) thickness = 2 cv2.rectangle(img, start, end, color, thickness) cv2.namedWindow(u"识别") cv2.imshow(u"识别", img) cv2.waitKey(0) cv2.destroyAllWindows() 转载请标明出处:python 人脸检测
文章来源: python 人脸检测