Exemplo n.º 1
0
def cutFace(real_path, face, img):
    box = numpy.int0([[face.left(), face.top()], [face.right(),
                                                  face.top()],
                      [face.right(), face.bottom()],
                      [face.left(), face.bottom()]])
    points = common.cutImg("face.jpg", real_path, box,
                           (face.right() - face.left()),
                           (face.bottom() - face.top()), 1.1, img)
    return points
Exemplo n.º 2
0
def cutBrow(shape, img, real_path):
    # Save the feature points to array
    brow = numpy.array([[shape.part(17).x, shape.part(17).y],
                                                [shape.part(18).x, shape.part(18).y],
                                                [shape.part(19).x, shape.part(19).y],
                                                [shape.part(20).x, shape.part(20).y],
                                                [shape.part(21).x, shape.part(21).y],
                                                [shape.part(22).x, shape.part(22).y],
                                                [shape.part(23).x, shape.part(23).y],
                                                [shape.part(24).x, shape.part(24).y],
                                                [shape.part(25).x, shape.part(25).y],
                                                [shape.part(26).x, shape.part(26).y]
                                                ], numpy.int32)
    # Get the minimum rectangle 
    rect = cv2.minAreaRect(brow)
    box = cv2.boxPoints(rect)
    box = numpy.int0(box)
    # Cut eyebrows from iamge
    points = common.cutImg("brow.jpg", real_path, box, 7, 1 , 1.1, img)
    return points
Exemplo n.º 3
0
def cutLip(real_path, box, img):
    points = common.cutImg("lip.jpg", real_path, box, 21, 9, 1.5, img)
    return points
Exemplo n.º 4
0
def cutRightEye(real_path, box, img):
    points = common.cutImg("right_eye.jpg", real_path, box, 16, 9, 1.5, img)
    return points