Skip to content
Snippets Groups Projects
Commit ee46bf68 authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Changed function name + some minor modifications

parent 8323a99f
No related branches found
No related tags found
1 merge request!24Facedet utils generic
Pipeline #
......@@ -11,8 +11,8 @@ import importlib
import numpy as np
def getEyePos(lm):
#==============================================================================
def get_eye_pos(lm):
"""
This function returns the locations of left and right eyes
......@@ -22,7 +22,6 @@ def getEyePos(lm):
``lm`` : :py:class:`array`
A numpy array containing the coordinates of facial landmarks, (68X2)
**Returns:**
``right_eye``
......@@ -44,10 +43,6 @@ def getEyePos(lm):
return right_eye,left_eye
#==============================================================================
def detect_face_in_image(image, method = "dlib"):
"""
......@@ -136,8 +131,7 @@ def detect_faces_in_video(frame_container, method = "dlib"):
return annotations
#==============================================================================
def detect_face_landmarks_in_image(image, method = "dlib"):
"""
This function detects a face in the input image. Two oprions for face detector , but landmark detector is always the same
......@@ -177,11 +171,9 @@ def detect_face_landmarks_in_image(image, method = "dlib"):
except ImportError:
raise ImportError("No module named bob.ip.dlib")
if not hasattr(face_detection_module, 'FaceDetector'):
raise AttributeError("bob.ip." + method + " module has no attribute FaceDetector!")
#### Landmark detector
try:
......@@ -192,13 +184,10 @@ def detect_face_landmarks_in_image(image, method = "dlib"):
if not hasattr(landmark_detection_module, 'detect_landmarks_on_boundingbox'):
raise AttributeError("bob.ip.facelandmarksmodule has no attribute detect_landmarks_on_boundingbox!")
face_detector = face_detection_module.FaceDetector()
data = face_detector.detect_single_face(image)
annotations = {}
if ( data is not None ) and ( not all([x is None for x in data]) ):
......@@ -217,8 +206,7 @@ def detect_face_landmarks_in_image(image, method = "dlib"):
#print("LM",lm)
right_eye,left_eye = getEyePos(lm)
right_eye,left_eye = get_eye_pos(lm)
points = []
......@@ -236,13 +224,10 @@ def detect_face_landmarks_in_image(image, method = "dlib"):
annotations['right_eye'] = right_eye
return annotations
#==============================================================================
def detect_face_landmarks_in_video(frame_container, method = "dlib"):
"""
This function detects a face and face landmarks in each farme of the input video.
......@@ -288,3 +273,4 @@ def detect_face_landmarks_in_video(frame_container, method = "dlib"):
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment