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

```

你可能感兴趣的:(FaceRecognition)