def detect_faces_target(input_queue, output_queue, arguments):
    while True:
        frame = interruptible_get(input_queue)
        if frame == "":
            break
        try:
            for rectangle in FaceDetector.for_image(frame.image).detect_faces():
                frame = Frame(frame.id, frame.image.draw_rectangle(rectangle, Color(255, 0, 0)))
            
            output_queue.put(frame, block = True)
        except:
            traceback.print_exc(file=sys.stdout)
示例#2
0
def detect_face(image):
    faces = FaceDetector.for_image(image).detect_faces()
    face = None if len(faces) == 0 else faces[0]
    return face