我试图在Windows 10上的Spyder中使用opencv将视频转换为一系列帧。我想通过将cv2.pyd复制到库中来告诉我能够导入cv2 Anaconda的文件夹。
我尝试运行此代码:
import cv2
import numpy as np
import os
# Playing video from file:
vidcap = cv2.VideoCapture('example.mp4')
success,image = vidcap.read()
# image is an array of array of [R,G,B] values
count = 0;
while success:
print count
success,image = vidcap.read()
cv2.imwrite("frame%d.jpg" % count, image) # save frame as JPEG file
if cv2.waitKey(10) == 27: # exit if Escape is hit
break
count += 1
但我没有得到任何错误,没有任何反应。