test_opencv.py 文件源码

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

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

    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 i, face in enumerate(faces):
        print('({0},{1},{2},{3}) score={4}'.format(face.left, face.top, face.right, face.bottom, face.score))
        cv2.rectangle(image_color, (face.left, face.top), (face.right, face.bottom), (0,255,0), thickness=2)
        cv2.putText(image_color, str(i), (face.left, face.bottom),cv2.FONT_HERSHEY_COMPLEX, 1, (0,255,0), thickness=1)
    cv2.imshow('test', image_color)
    cv2.waitKey(0)

    detector.release()
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号