【发布时间】:2016-12-31 21:43:39
【问题描述】:
我正在运行一个简单的程序来读取视频文件(.mp4 格式)并在反转每一帧后将其写回。我收到错误和错误警告。
BUG: The current event queue and the main event queue are not the same. Events will not be handled correctly. This is probably because _TSGetMainThread was called for the first time off the main thread.
Error in CoreDragRemoveTrackingHandler: -1856
我正在使用 El Captain OSX,我已经安装了 python 虚拟环境以使用 Python 3.5 和 OpenCV 3.2.0-rc。有人可以帮我解决这个问题吗?
谢谢
import numpy as np
import cv2
cap = cv2.VideoCapture('Root.mp4')
# Define the codec and create VideoWriter object
#fourcc = cv2.VideoWriter_fourcc(*'AVRN')
#out = cv2.VideoWriter('Root1.mp4',fourcc, 20.0, (640,360))
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out = cv2.VideoWriter('Root1.avi',fourcc, 20.0, (640,360))
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 finished
cap.release()
out.release()
cv2.destroyAllWindows()
【问题讨论】:
-
总是放文本而不是屏幕截图 - 现在没有人可以复制粘贴您的代码来测试它并进行修改。
-
好的。谢谢。我会改的
-
也许可以在OpenCV issues询问
标签: python python-3.x opencv computer-vision opencv3.0