Created
February 9, 2012 10:44
-
-
Save stokasto/1779208 to your computer and use it in GitHub Desktop.
convert video to numpy array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import * | |
import cv | |
capture = cv.CaptureFromFile('video.mov') | |
frames = [] | |
for i in range(100): | |
img = cv.QueryFrame(capture) | |
tmp = cv.CreateImage(cv.GetSize(img),8,3) | |
cv.CvtColor(img,tmp,cv.CV_BGR2RGB) | |
frames.append(asarray(cv.GetMat(tmp))) | |
frames = array(frames) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I have tried to show the frames using matplotlib but facing issues with the size. Is there a better way to display the frames?
Thanks