face2movie.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:face2movie 作者: Stunkymonkey 项目源码 文件源码
def calculatePicture(file):
    """gettings infos of the image and applie the matrixes"""
    img = cv2.imread(file)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    faces, eyes = detect(img, gray)
    # print("faces: " + str(faces) + " # eyes:" + str(eyes))
    height, width, channels = img.shape

    if faces is None or eyes is None:
        return None

    face = faces[0]
    eye = [eyes[0], eyes[1]]

    moveMatrix, rotMatrix = matrixPicture(face, eye, height, width)

    dst = cv2.warpAffine(img, moveMatrix, (width, height))
    dst = cv2.warpAffine(dst, rotMatrix, (width, height))

    return dst
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号