I'm trying to use OpenCV from Python for some video processing and it works extremely slow for me. For example a simple reading and showing of all frames works at about 1 fps:
import cv2
cap = cv2.VideoCapture("out1.avi")
cv2.namedWindow("input")
while(True):
f, img = cap.read()
cv2.imshow("input", img)
cv2.waitKey(1)
The same video file in C++ is rendered without any problems at about 30 fps. Are there any ideas why Python version is so slow?
And there is another interesting thing about Python version: it doesn't show .wmv files which C++ version can process (for my Python can open raw video only).
I use OpenCV 2.3.1 and Python 2.7
Thanks for help!
The code runs normally (fast) in my machine (opencv 2.3.0 & python 2.6.4 on win7-64, playing uncompressed avi file).
have you tried the performance using older python interface (cv instead of cv2)?
regarding .wmv video playback, it's kinda having problem with python interface (or specifically the ffmpeg). it can't play other than uncompressed .avi files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With