Example #1
0
    def detect(self, image):
        face_detector = FaceDetector()
        glasses_detector = GlassesDetector()
        profile_detector = ProfileDetector()

        face_points = face_detector.detect(image) or []
        glasses_points = glasses_detector.detect(image) or []
        profile_points = profile_detector.detect(image) or []

        return face_points + glasses_points + profile_points
Example #2
0
    def detect(self, image):
        face_detector = FaceDetector()
        feature_detector = FeatureDetector()

        feature_points = []

        face_points = face_detector.detect(image) or []

        if not face_points:
            feature_points = feature_detector.detect(image) or []

        return face_points + feature_points
 def test_should_run_on_grayscale_images(self):
     detection_result = FaceDetector().detect(create_image('multiple_faces_bw.jpg'))
     expect(detection_result).to_be_greater_than(4)
     expect(detection_result[0][0]).to_be_numeric()
     expect(detection_result[0][1]).to_be_numeric()
     expect(detection_result[0][2]).to_be_numeric()
     expect(detection_result[0][3]).to_be_numeric()
 def test_should_detect_one_face(self):
     detection_result = FaceDetector().detect(create_image('one_face.jpg'))
     expect(detection_result).to_length(1)
     expect(detection_result[0][0]).to_be_numeric()
     expect(detection_result[0][1]).to_be_numeric()
     expect(detection_result[0][2]).to_be_numeric()
     expect(detection_result[0][3]).to_be_numeric()
Example #5
0
 def test_should_run_on_cmyk_images(self):
     detection_result = FaceDetector().detect(
         create_image("one_face_cmyk.jpg"))
     expect(detection_result[0][0]).to_be_numeric()
     expect(detection_result[0][1]).to_be_numeric()
     expect(detection_result[0][2]).to_be_numeric()
     expect(detection_result[0][3]).to_be_numeric()
Example #6
0
 def __init__(self):
     self.detectors = {
         'all': CompleteDetector(),
         'face': FaceDetector(),
         'feat': FeatureDetector(),
         'glas': GlassesDetector(),
         'prof': ProfileDetector()
     }
Example #7
0
 def __init__(self):
     self.detectors = {
         "all": CompleteDetector(),
         "face": FaceDetector(),
         "feature": FeatureDetector(),
         "glass": GlassesDetector(),
         "profile": ProfileDetector(),
     }
Example #8
0
 def test_should_run_on_grayscale_images(self):
     # Group Smile picture - Credit Richard Foster / Flickr Creative Commons
     detection_result = FaceDetector().detect(
         create_image("group-smile-bw.jpg"))
     expect(len(detection_result)).to_be_greater_than(4)
     expect(detection_result[0][0]).to_be_numeric()
     expect(detection_result[0][1]).to_be_numeric()
     expect(detection_result[0][2]).to_be_numeric()
     expect(detection_result[0][3]).to_be_numeric()
 def test_should_run_on_images_with_alpha(self):
     detection_result = FaceDetector().detect(create_image('one_face.png'))
     expect(detection_result[0][0]).to_be_numeric()
     expect(detection_result[0][1]).to_be_numeric()
     expect(detection_result[0][2]).to_be_numeric()
     expect(detection_result[0][3]).to_be_numeric()
Example #10
0
 def test_should_not_detect(self):
     detection_result = FaceDetector().detect(create_image('no_face.jpg'))
     expect(detection_result).to_be_empty()