PS3Eye FPS measuring and real framerate
Posted: 01 March 2011 07:50 AM   [ Ignore ]
New Member
Rank
Total Posts:  2
Joined  2011-01-18

Hi. I tried to determine, what real fps I can get from PS3Eye, so I wrote this app:

const int framesMultiplier 5;

void capture(int camIndexint freqCLEyeCameraResolution res{
    GUID cameraGUID 
CLEyeGetCameraUUID(camIndex);
    
CHAR windowName[256]strcpy_s(windowName"Capture Window");
    
int whframe 0;
    
unsigned __int64 start 0end 0QPF 0;
    
float time 0realFPS 0;
    
IplImage *pCapImage;
    
CLEyeCameraInstance cam CLEyeCreateCamera(cameraGUIDCLEYE_COLOR_RAWresfreq);
    
CLEyeCameraGetFrameDimensions(camwh);
    
pCapImage cvCreateImage(cvSize(wh), IPL_DEPTH_8U4);
    
CLEyeCameraStart(cam);
    
QueryPerformanceCounter((PLARGE_INTEGER)&start;);
    
PBYTE pCapBuffercvGetImageRawData(pCapImage, &pCapBuffer;);
    while(
frame != freq*framesMultiplier{    
        CLEyeCameraGetFrame
(campCapBuffer2000);
        
cvShowImage(windowNamepCapImage);
        
frame++;
        if (
cvWaitKey(10) == 0x1b{break;}
    }
    QueryPerformanceCounter
((PLARGE_INTEGER)&end;);
    
QueryPerformanceFrequency((PLARGE_INTEGER) &QPF;);
    
time = (float)(end-start)/(float)QPF;
    
realFPS = (freq*framesMultiplier)/time;
    
cout << "Time for test: " << time << endl;
    
cout << "FPS: " << realFPS << endl;
    
CLEyeCameraStop(cam);
    
CLEyeDestroyCamera(cam);
    
cvReleaseImage(&pCapImage;);
    
cam NULL;
    
cvDestroyWindow(windowName);
}

int _tmain
(int argc_TCHARargv[]{
    
for (int i 0CLEyeGetCameraCount(); i++) {
        capture
(i75CLEYE_VGA);
    
}
    _getch
();
    return 
0;

Then I start app with different freq and res. Thing I don’t really get is that I receive a maximum 63,5 FPS on both VGA and QVGA resolution. This means it’is not a USB bandwidth problem. PS3Eye don’t support higher FPS or it’s driver trouble, or it’s a my app trouble?

App shows FPS correctly, if I choose freq (15, 30, 50) for VGA:

15 Hz VGATime for test5.03177 FPS14.9053
30 Hz VGA
Time for test5.04248 FPS29.7472
40 Hz VGA
Time for test6.03324 FPS33.1497
50 Hz VGA
Time for test5.03597 FPS49.6429
60 Hz VGA
Time for test5.18322 FPS57.8791
75 Hz VGA
Time for test5.9171  FPS63.3756 

On 40, 60 and 75 Hz frames are loses.

Then I change main cycle like this:

for (int i 30100i++) {
    cout 
<< "Set frequency to " << << " hz:" << endl;
    
capture(0iCLEYE_VGA);

Result was weird (not all results are shown):

Set frequency to 33 hzTime for test2.02071 FPS32.6618
Set frequency to 34 hz
Time for test2.07368 FPS32.7919
Set frequency to 35 hz
Time for test2.1341  FPS32.8007
Set frequency to 36 hz
Time for test1.96116 FPS36.713
Set frequency to 39 hz
Time for test2.3781  FPS32.7994
Set frequency to 40 hz
Time for test2.43241 FPS32.8893
Set frequency to 44 hz
Time for test1.99173 FPS44.1826
Set frequency to 47 hz
Time for test2.12689 FPS44.1959
Set frequency to 48 hz
Time for test1.95644 FPS49.0686
Set frequency to 55 hz
Time for test2.05889 FPS53.4269
Set frequency to 56 hz
Time for test2.02461 FPS55.3194
Set frequency to 60 hz
Time for test2.08597 FPS57.5273
Set frequency to 70 hz
Time for test2.58228 FPS54.2157
Set frequency to 71 hz
Time for test2.25962 FPS62.8425
... From 72 to 99 Hz 63 FPS 

There are a loses on QVGA resolution on 33, 38-39, 46, 55 and other frequencies and also on 75, 100 and 125 Hz real FPS is ~63

In the end, I’ve try FRAPS to confirm this result, and it was exactly the same (only in integer values, not float).

Profile
 
 
Posted: 10 March 2011 10:02 AM   [ Ignore ]   [ # 1 ]
New Member
Rank
Total Posts:  7
Joined  2010-11-03

One obvious problem: cvWaitKey(10). This locks your thread for 10 ms. 60hz is a period of 16ms, so it’s clear this is causing the frame rate to max out at 62hz.

Profile
 
 
Posted: 12 March 2011 10:25 PM   [ Ignore ]   [ # 2 ]
New Member
Rank
Total Posts:  2
Joined  2011-01-18

Wish you were right, but changing to cvWaitKey(1) don’t resolve problem. Actually, nothing’s happen.

Profile
 
 
 
 


RSS 2.0     Atom Feed