OpenCV Video capture and fps problem

Posted by Andrea Girardi on Stack Overflow See other posts from Stack Overflow or by Andrea Girardi
Published on 2009-07-22T20:59:34Z Indexed on 2010/03/17 11:41 UTC
Read the original article Hit count: 939

Filed under:
|
|
|
|

Hi to all,

I'm capturing video from my webcam using OpenCV on MacOSX. It works fine but when I try to play on QuickTime my captured video it plays too fast. i.e. I capture from camera for 10 seconds but when I play on QuickTime the video is 2 seconds.

I've tried to change fps from 25 to 10 and It's works quite fine, but I'm sure it's not the correct process:

CvVideoWriter *writer = 0;  
int isColor = 1;
int fps     = 25;
int frameW  = 640; // 744 for firewire cameras
int frameH  = 480; // 480 for firewire cameras

The problem is that for now I've to capture with WebCam but the real pourpose of program is to capture image from any external source connected to my Mac.

I'm using this code to capture:

for (;;) {
  cvGrabFrame(capture)
  image = cvRetrieveFrame(capture);
  cvWriteFrame( writer, image );
}

Any hint? I'm also showing webcam output on cvNamedWindow, how can I improve quality in this windows?

thanks a lot to all!

Andrea!

© Stack Overflow or respective owner

Related posts about opencv

Related posts about mac