opencv视频处理 pytorch
一个是视频的读取,即帧读取(然后存起来)
一个是生成视频,用一帧帧图片
代码如下
import cv2
import os
import numpy as np
# save the frame photos of video
def save_image(image, dir_path, imageid):
img_path = dir_path + '/frame_{:0>4d}.png'.format(imageid)
cv2.imwrite(img_path, image)
# read the frames of video
def read_video(video_path):
# read the video
videoCapture