forked from regression1607/HacktoberFest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathImport_face_utils
More file actions
29 lines (25 loc) · 847 Bytes
/
Import_face_utils
File metadata and controls
29 lines (25 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Supported detection models
face_recognition (hog and cnn)
retina face model
haar cascade face detection
more to be added in the next releases
Installation
OS X & Linux using PIP :
pip install face-utils
Features
Face Detection
By creating an object of the face detection model you want you can use it to detect the faces in images.
I have also implemented outputs forms such as 1 : (x,y,w,h) and 2 : (top,right,bottom,left )
Face cropping
ability to crop the face from the image given the detector result
You can also zoom in and out from the face.
Example
import cv2
from face_utils.detection import Detector
from face_utils.cropping import cropping
imgPath = "files/Obama.jpg"
img = cv2.imread(imgPath)
img= np.array(img)
model = Detector("hog")
bbox = model.detect(img,2) #using (x,y,w,h) return mode
face = cropping.crop(img,bbox,1,80,80)