Faizal2805 commited on
Commit
1e9de5f
·
verified ·
1 Parent(s): 1a68e7e

Update app/process.py

Browse files
Files changed (1) hide show
  1. app/process.py +14 -0
app/process.py CHANGED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import mediapipe as mp
3
+
4
+ mp_face_detection = mp.solutions.face_detection
5
+ mp_drawing = mp.solutions.drawing_utils
6
+
7
+ def detect_faces(image_path):
8
+ image = cv2.imread(image_path)
9
+ with mp_face_detection.FaceDetection(model_selection=1, min_detection_confidence=0.5) as face_detection:
10
+ results = face_detection.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
11
+ if results.detections:
12
+ for detection in results.detections:
13
+ mp_drawing.draw_detection(image, detection)
14
+ return image