似乎在或中
cv2.videopre都不有效。
OpenCV API``OpenCV 2.x``OpenCV 3.x
下面是
OpenCV 3使用
cv2.VideoCapture类的示例代码。
import numpy as npimport cv2# Open a sample video available in sample-videosvcap = cv2.VideoCapture('https://www.sample-videos.com/video/mp4/720/big_buck_bunny_720p_2mb.mp4')#if not vcap.isOpened():# print "File Cannot be Opened"while(True): # Capture frame-by-frame ret, frame = vcap.read() #print cap.isOpened(), ret if frame is not None: # Display the resulting frame cv2.imshow('frame',frame) # Press q to close the video windows before it ends if you want if cv2.waitKey(22) & 0xFF == ord('q'): break else: print "frame is None" break# When everything done, release the capturevcap.release()cv2.destroyAllWindows()print "Video stop"
您可以查看此视频入门教程以获取更多信息。
希望对您有所帮助。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)