FaceRecognition

demo_process.py


```

def onevideo2frame(video_path,width_factor,height_factor,interval):

frame_all=[]

cap = cv2.VideoCapture(video_path)

frame_read_index =1

    if cap.isOpened():

success =True

    else:

success =False

        # print("{}读取失败!".format(video_path))

    while (success):

success, frame = cap.read()

# print("---> 正在读取第%d帧:" % frame_read_index, success)

        if successand frame_read_index % interval ==0:

# resize_frame=cv2.resize(frame,(1000,1000))

# resize_frame=cv2.resize(frame,(0,0),fx=width_factor,fy=height_factor)

            frame_all.append(frame)

frame_read_index +=1

    cap.release()

return frame_all

```

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容