face_training.py 文件源码

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

项目:face-recognition 作者: pratush07 项目源码 文件源码
def face_train_video(train_path,subject,max_train,stream):
    cap = cv2.VideoCapture(stream)
    ret=True
    ctr = 0
    # minimum 10 frames/images per video 
    while(ctr < max_train):
        # read till end of frames
        ret, img = cap.read()
        if not ret:
            break
        gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)  
        cv2.imshow("Recognizing Face", img)
        cv2.waitKey(10)
        cv2.imwrite( join(train_path,subject)+ "." + str(ctr) +".jpg",img) # writes image  to disk
        ctr = ctr + 1
    cap.release()
    cv2.destroyAllWindows()

# predict live feed
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号