当前位置:   article > 正文

video2frames - 把视频切割成一帧帧的图片_video2frame-frame2video

video2frame-frame2video

 

 

  1. def video2frames(video_path, newdir):
  2. cap = cv2.VideoCapture(video)
  3. count = 0
  4. while (cap.isOpened()):
  5. ret, frame = cap.read()
  6. if True:
  7. if ret == True:
  8. # cv2.imshow('video2frames', frame)
  9. # cv2.waitKey(0)
  10. subpath = '/{}.jpg'.format(count)
  11. cv2.imwrite(newdir + subpath, frame)
  12. count += 1
  13. else:
  14. break
  15. return count
  16. os.mkdir(newdir)
  17. frames_num = video2frames(video_path, newdir)

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/在线问答5/article/detail/944741
推荐阅读
相关标签
  

闽ICP备14008679号