Well, I do not want to talk much more about what it is FPS, you can find yourself in google. I just want to help you if your camera doesn't support with FPS.
Get Frame information in OpenCV:
- int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
- float posMsec = cvGetCaptureProperty(capture, CV_CAP_PROP_POS_MSEC);
- int posFrames = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_POS_FRAMES);
- float posRatio = cvGetCaptureProperty(capture, CV_CAP_PROP_POS_AVI_RATIO);
#include "time.h"
int main (int argc, char* argv[])
{
int fps,fpsfix,second;
...
...
SYSTEMTIME st; //time & date function in c ++
...
while(1) //insert in your looping
{
// how to make fps !!
sprintf(f, "%d", fpsfix);
fps = fps++;
GetSystemTime(&st); //using GetSystemTime function.
if (second != st.wSecond) //if the second is not same as before then record fps
{
fpsfix = fps;
fps = 0;
}
second = st.wSecond;
cvPutText (frame,"fps : ",cvPoint(10,230), &font2, cvScalar(0,255,0));
cvPutText (frame,f,cvPoint(40,230), &font2, cvScalar(0,255,0));
...
}
return 0;
}

picture 0_frame_per_second

0 comments:
Post a Comment