I'm working on a project which need low resolution and about 110 fps. So i bought 30$ PlayStation eye which provide 120 fps in 320 in 240 resolution.
I installed previous version of macam( because latest version didn't work ) and successfully get about 120 fps( but i can't record because of some bugs in macam ).
I wrote a simple code to save each frame as a jpg file:
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
#include<iostream>
using namespace std;
int main(int argc, char** argv) {
int i = 0;
char *buf;
IplImage *frame;
CvCapture* capture = cvCreateCameraCapture(3);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, 320);
cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, 240);
cvSetCaptureProperty( capture, CV_CAP_PROP_FPS, 110);
while (true) {
frame = cvQueryFrame(capture);
asprintf(&buf, "%d.jpg", i++);
cvShowImage("1", frame);
cvSaveImage(buf, frame);
cvWaitKey(10);
}
return 0;
}
but it's only save 30 frames per second. I mean it creates 30 files instead of 110 files per second. What's the problem ?
Update: i compile above code using following command:
g++ main.cpp `pkg-config --cflags opencv` `pkg-config --libs opencv` -o exec -m32
cvWaitKey(10);
waits for 10ms.
A frame rate of 110Hz requires a snapshot every 9ms, plus there is processing time for the saving of the frame.
So that's an issue here, in addition to CV_CAP_PROP_FPS
not working as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With