State-of-the-art face detection and landmarks localization
Project description
Face Detector
This python package provides state-of-the-art face detection as well as face landmark points localization. It gathers the techniques implemented in dlib and mtcnn[], which can be easily switched between by setting a parameter in the FaceDetector class instantiation (mtcnn is default if no technique is specified, use fl_5 for dlib with 5 landmarks and fl_68 for dlib with 68 landmarks).
How to Install:
pip install face-detector
How to Use:
from face_detector import FaceDetector
img_addr = "path/to/image.[jpg/png/jpeg ...]"
# First parameter in FaceDetector constructor specifies face detection method (dlib: fl_5 or fl_68, mtcnn is default: mtcnn)
face_detector = FaceDetector()
faces = face_detector.get_faces(img_addr)
# Or to get the most prominent face in photo
main_face = face_detector.get_main_face(img_addr)
# Show image with bounding boxes and landmarks
import cv2
img = cv2.imread(img_addr)
for face in faces:
bb = face.bounding_box
landmarks = face.landmarks
cv2.rectangle(img, (int(bb.x), int(bb.y)), (int(bb.x + bb.w), int(bb.y+bb.h)), (0, 255, 0), 1)
for l in landmarks:
cv2.circle(img, (l.x, l.y), 2, (0,0,255))
cv2.imshow('img', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for face_detector-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccaa7a48de7f46d9f28ff5f07c57e2e4a572f9fdab9e03f9c2e398b03d793faa |
|
MD5 | 80a5417661c1aa2744e62e1cde335d44 |
|
BLAKE2b-256 | 4500f174f868cc8870cc11425204168676b86e04ee943f0cdf665d0386d2760c |