Ask Your Question

shw1231's profile - activity

2015-06-14 13:26:10 -0600 asked a question Unable to extract frames from saved video file using opencv + python

Hi, I have already one video file and i want to extract frames from the same. Can you please suggest me some code to do the same?

2015-06-07 06:10:36 -0600 answered a question Unable to extract frames from video file

Hi, I don't want to capture video from camera. I have already one video file and i want to extract frames from the same. Can you please suggest me some code to do the same?

2015-05-31 13:15:53 -0600 asked a question Unable to extract frames from video file

Hi All,

when i am trying to extract images from a video file, it is keep on extracting images and counter does not stop. For eg: I am using video file of 25fps and of 41 second duration. So the count is coming approximately 1025. But my code is not stopping after 1025 and it keeps on extracting empty images after 1025. Please check my code and help me out.

import cv2

import cv2.cv as cv

import sys

import os

import numpy as np

import PIL

from matplotlib import pyplot as plt

invideo1 = cv.CaptureFromFile("flower.mp4")

totalNumberOfFrames1 = int(cv.GetCaptureProperty(invideo1, cv.CV_CAP_PROP_FRAME_COUNT)) framesprocessing1 = totalNumberOfFrames1 print(totalNumberOfFrames1)

count =0;

while (True):

im1 = cv.QueryFrame(invideo1)

cv.SaveImage('c://Shweta//opencv_poc//video1//frames1//pic'+str(count)+'.jpg', im1)

if cv.WaitKey() == 27: # ASCII 27 is the ESC key
    break
count +=1

del invideo

cv.DestroyWindow(winname)