OpenCV中文网站

 找回密码
 立即注册
搜索
热搜: 安装 配置
查看: 2837|回复: 2

保存视频是倒立的

[复制链接]
发表于 2018-11-20 15:23:07 | 显示全部楼层 |阅读模式
  1. import numpy as np
  2. import cv2 as cv
  3. cap = cv.VideoCapture(0)
  4. # Define the codec and create VideoWriter object
  5. fourcc = cv.VideoWriter_fourcc(*'XVID')
  6. out = cv.VideoWriter('output.avi',fourcc, 20.0, (640,480))
  7. while(cap.isOpened()):
  8.     ret, frame = cap.read()
  9.     if ret==True:
  10.         frame = cv.flip(frame,0)
  11.         # write the flipped frame
  12.         out.write(frame)
  13.         cv.imshow('frame',frame)
  14.         if cv.waitKey(1) & 0xFF == ord('q'):
  15.             break
  16.     else:
  17.         break
  18. # Release everything if job is finished
  19. cap.release()
  20. out.release()
  21. cv.destroyAllWindows()
复制代码


回复

使用道具 举报

发表于 2018-11-20 15:48:10 | 显示全部楼层
你自己写的代码让它倒过来的,又来问为什么,建议自己把每一句代码理解了再问吧
回复 支持 反对

使用道具 举报

发表于 2018-11-20 20:16:05 | 显示全部楼层
frame = cv.flip(frame,0)   
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|OpenCV中文网站

GMT+8, 2024-4-20 16:18 , Processed in 0.008683 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表