czly
czly
2017-08-13 11:32

python cv2 读取png生成视频失败是什么原因?

10
  • python
  • opencv图像识别
  • 视频

import cv2
from cv2 import VideoWriter,VideoWriter_fourcc,imread,resize
import os
img_root='G:/dancitupian/dancitupian/noexist'

fps=5
fourcc=VideoWriter_fourcc(*"MJPG")
videoWriter=cv2.VideoWriter('g:/python/english.mpg',fourcc,fps,(1280,720))

im_names=os.listdir(img_root)
for temp in im_names:
print img_root+'/'+temp
frame=cv2.imread(img_root+'/'+temp)
videoWriter.write(frame)

videoWriter.release()

没有报错,只是找不到生成的文件,是什么原因?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答