# coding=utf-8
import cv2
vc = cv2.VideoCapture('./video_Data/6.MOV') #读入视频文件
c=0
rval=vc.isOpened()
timeF = 12 #视频帧计数间隔频率
while rval: #循环读取视频帧
print(c)
c = c + 1
rval, frame = vc.read()
re_frame = cv2.flip(frame, -1)#图像翻转
if(c%timeF == 0): #每隔timeF帧进行存储操作
# cv2.imwrite('smallVideo/smallVideo'+str(c) + '.jpg', frame) #存储为图像
# if rval:
#img为当前目录下新建的文件夹
cv2.imwrite('./in_pic/29-6/'+str(c) + '-29-6.jpg', re_frame) #存储为图像
cv2.waitKey(1)
# else:
# break
vc.release()
视频转图片保存脚本
最新推荐文章于 2021-10-27 20:01:47 发布