2

I am really new to openCV and I would like to break a video file that I have (*.avi) into separate frames.

Does anyone know how to do it?

Thanks!!

N.M
  • 685
  • 1
  • 9
  • 22
  • possible duplicate of [openCV: How to split a video into image sequence?](http://stackoverflow.com/questions/4350698/opencv-how-to-split-a-video-into-image-sequence) – karlphillip Jun 15 '11 at 21:18
  • The answer is http://stackoverflow.com/questions/4350698/opencv-how-to-split-a-video-into-image-sequence/4353483#4353483 – karlphillip Jun 15 '11 at 21:19

2 Answers2

3

Take a look at cvCaptureFromFile, cvQueryFrame and cvSaveImage ! They'll do everything you need.

user703016
  • 37,307
  • 8
  • 87
  • 112
  • Thank you very much! Do you happen to know how I convert the received image into gray-scale? Thanks!!! – N.M Jun 07 '11 at 08:52
1

If you're more comfortable with using the C++ API, the VideoCapture class (see http://opencv.jp/opencv-2.2_org/cpp/highgui_reading_and_writing_images_and_video.html#videocapture) is very convenient to use.

susmits
  • 2,210
  • 2
  • 23
  • 27