@H_419_8@
@H_419_8@
def OnRecord(self,evt): capture = cv2.VIDeoCapture(0) if (not capture.isOpened()): print "Error"# vIDeo recorder fourcc = cv2.cv.CV_FOURCC(*'XVID') # cv2.VIDeoWriter_fourcc() does not exist vIDeo_writer = cv2.VIDeoWriter.open("output.mp4",fourcc,20,(640,480),True) # record vIDeo while (capture.isOpened()): ret,frame = capture.read() if ret==True: vIDeo_writer.write(frame) cv2.imshow('VIDeo',frame) else: breakdef OnCancel(self,evt): capture.release() vIDeo_writer.release() cv2.destroyAllwindows()
但它只打印错误.@H_419_8@
所以我猜捕获不是开放.可能是什么原因?@H_419_8@
我从opencv文档中尝试了这个代码,但对我来说没有用.@H_419_8@
@H_419_8@
import numpy as npimport cv2cap = cv2.VIDeoCapture(0)# define the codec and create VIDeoWriter objectfourcc = cv2.VIDeoWriter_fourcc(*'XVID')out = cv2.VIDeoWriter('output.avi',20.0,480))while(cap.isOpened()): ret,frame = cap.read() if ret==True: frame = cv2.flip(frame,0) # write the flipped frame out.write(frame) cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break# Release everything if job is finishedcap.release()out.release()cv2.destroyAllwindows()
任何帮助将不胜感激.@H_419_8@解决方法 加载正确的视频4 linux驱动程序
@H_419_8@
@H_419_8@
sudo modprobe bcm2835-v4l2@H_502_40@ 总结
以上是内存溢出为你收集整理的python – cv2.videocapture不适用于Raspberry-pi全部内容,希望文章能够帮你解决python – cv2.videocapture不适用于Raspberry-pi所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)