View Full Version : getCurrentMaxAvailableFPS in DBx 21AG04

November 12, 2009, 12:14:24

I recently purchased some DBx 21AG04 cameras. I´m running into some trouble on the initialization code.

Basically all I need to do is to initialize whichever camera is attached to the highest fps available in RGB24 mode. I can´t use setupDeviceFromFile() because i´m writing a fullscreen DirectX application.

Currently, on the initialization code I´m using Grabber::getCurrentMaxAvailableFPS to get the maximum frames per second available, so I can set the fps correctly.

This is proving a bit problematic because the new cameras give back 3.75 as the maximum FPS available, when in fact it should be 60 (and it does go up to 60 fps in the demo application).

Previously I was using the DBx 21AF04 and it was no problem doing it this way since the maximum FPS always came back as being 60, as expected.

This is the full initialization code I´m using right now:

Grabber::tVidCapDevListPtr pVidCapDevList = m_pGrabber->getAvailableVideoCaptureDevices();
if( pVidCapDevList == 0 || pVidCapDevList->empty() )
delete m_pGrabber;
return -1; //no device available.

return -1;

//create the frame handler sink
tFrameHandlerSinkPtr m_pSink = FrameHandlerSink::create(eRGB24, 2);

//disable snap mode

//apply the sink to the grabber.

//set highest possible FPS value
double highestFps = m_pGrabber->getCurrentMaxAvailableFPS();
//highestFps = 60.0; //uncomment this and it will work perfectly at 60 fps!
double currentFps = m_pGrabber->getFPS();

//start the grabber

Please note that if I just override the highest fps to 60.0, it will work perfectly, as shown in the comments.

Ideally, I´d like a piece of code which will solve this problem and always initialize to the maximum framerate at RGB24.

Thanks very much!

Stefan Geissler
November 12, 2009, 14:52:43

I suggest to run through the available frame rates, after the video format has been set, and get the biggest one, which is used to be set at the grabber:

float maxrate = 0.0f;

for ( Grabber::tFPSList::iterator it = pFrameRateList->begin(); it != pFrameRateList->end(); ++it )
if( (*it) > maxrate )
maxrate = (*it);


(I did not test the loop on my own, I just copied it from another sample ("Making Device Settings")). This attempt should do the job, regardless the sort of frame rates in the list.