test_opencv.py 文件源码

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

项目:pyseeta 作者: TuXiaokang 项目源码 文件源码
def test_aligner():
    print('test aligner:')
    # load model
    detector = Detector('SeetaFaceEngine/model/seeta_fd_frontal_v1.0.bin')
    detector.set_min_face_size(30)
    aligner = Aligner('SeetaFaceEngine/model/seeta_fa_v1.1.bin')

    image_color = cv2.imread('data/chloecalmon.png', cv2.IMREAD_COLOR)
    image_gray = cv2.cvtColor(image_color, cv2.COLOR_BGR2GRAY)

    faces = detector.detect(image_gray)

    for face in faces:
        landmarks = aligner.align(image_gray, face)
        for point in landmarks:
            cv2.circle(image_color, point, 1, (0,255,0), 2)

    cv2.imshow('test aligner', image_color)
    cv2.waitKey(0)

    aligner.release()
    detector.release()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号