Chris Barnes
2014-10-10 16:41:54 UTC
I'm a new grad student who's spent the last 3 days trying to grab some
frames from a .avi with zero success. I've tried pythons 2 and 3, openCV,
simpleCV, simpleITK, scikit-image, and ffmpeg, and have run into different
issues with each. Is it really that hard? There's next to no documentation
around for all of them, for sure.
All of the above claim to have installed correctly (e.g. skimage, SimpleITK
and SimpleCV can be imported fine, openCV responds fine to cv2.__version__,
which is what they claim defines a healthy install).
I guess the nut to crack is openCV as that's the one that's talked about
most on the internet. However, using this code snippet
from http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html
import numpy as np
import cv2
cap = cv2.VideoCapture('vtest.avi')
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
cap.isOpened() is always false, so no reading gets done.
I know that skimage uses openCV as the backend, but I gave it ago anyway,
using this snippet from http://scikit-image.org/docs/dev/api/skimage.io.html
class AVILoader:
video_file = 'myvideo.avi'
def __call__(self, frame):
return video_read(self.video_file, frame)
avi_load = AVILoader()
frames = range(0, 1000, 10) # 0, 10, 20, ...
ic = ImageCollection(frames, load_func=avi_load)
x = ic[5] # calls avi_load(frames[5]) or equivalently avi_load(50)
Of course, that's junk too because video_read just isn't a function. Google
gets 8 results associating video_read with skimage.
I also tried this method to get the video straight into a numpy
array http://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/
It took a long time, crash my IDE a couple of times, and came up with no
data at the end.
I'm frustrated. How do you get started?
frames from a .avi with zero success. I've tried pythons 2 and 3, openCV,
simpleCV, simpleITK, scikit-image, and ffmpeg, and have run into different
issues with each. Is it really that hard? There's next to no documentation
around for all of them, for sure.
All of the above claim to have installed correctly (e.g. skimage, SimpleITK
and SimpleCV can be imported fine, openCV responds fine to cv2.__version__,
which is what they claim defines a healthy install).
I guess the nut to crack is openCV as that's the one that's talked about
most on the internet. However, using this code snippet
from http://opencv-python-tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html
import numpy as np
import cv2
cap = cv2.VideoCapture('vtest.avi')
while(cap.isOpened()):
ret, frame = cap.read()
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
cap.isOpened() is always false, so no reading gets done.
I know that skimage uses openCV as the backend, but I gave it ago anyway,
using this snippet from http://scikit-image.org/docs/dev/api/skimage.io.html
class AVILoader:
video_file = 'myvideo.avi'
def __call__(self, frame):
return video_read(self.video_file, frame)
avi_load = AVILoader()
frames = range(0, 1000, 10) # 0, 10, 20, ...
ic = ImageCollection(frames, load_func=avi_load)
x = ic[5] # calls avi_load(frames[5]) or equivalently avi_load(50)
Of course, that's junk too because video_read just isn't a function. Google
gets 8 results associating video_read with skimage.
I also tried this method to get the video straight into a numpy
array http://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/
It took a long time, crash my IDE a couple of times, and came up with no
data at the end.
I'm frustrated. How do you get started?
--
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "pythonvision" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonvision+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/d/optout.