PDA

View Full Version : When Grabber::setVideoFormat return wrong?



yan_zhao_ep
June 23, 2014, 20:16:19
Hi,

In the online documentation (http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descGrabber_setVideoFormat.htm), it says the setVideoFormat function returns true if the video format could be changed successfully, false otherwise.

But from my testing, I found that the function is not very reliable. I have to try several times before I can set the video format.



/************************************************** ***********************/
/* Start to runt the test */
/************************************************** ***********************/
int nBaseWidth = 256;
int nBaseHeight = 192;
int nDelta = 100;
for(int i = 0; i < nTotalTests; i++)
{
char acROI[100];
sprintf(acROI, "RGB32 (%dx%d)", nBaseWidth+i*nDelta, nBaseHeight+i*nDelta);
std::cout<<"Try set to "<<acROI<<std::endl;

mpGrabber->setVideoFormat(acROI);
std::cout<<"Current Video Format: "
<<mpGrabber->getVideoFormat().c_str()<<std::endl;
mpGrabber->startLive();
for(int f = 0; f < nNumTotalFrames; f++)
{
pSink->snapImages(1);
}
mpGrabber->stopLive();
}


and my output is as following. And as you can see that I could only set some successfully.


Try set to RGB32 (256x192)
Current Video Format: RGB32 (256x192)

Try set to RGB32 (356x292)
Current Video Format: RGB32 (256x192)

Try set to RGB32 (456x392)
Current Video Format: RGB32 (256x192)

Try set to RGB32 (556x492)
Current Video Format: RGB32 (256x192)

Try set to RGB32 (656x592)
Current Video Format: RGB32 (656x592)

Try set to RGB32 (756x692)
Current Video Format: RGB32 (656x592)

Try set to RGB32 (856x792)
Current Video Format: RGB32 (656x592)

Try set to RGB32 (956x892)
Current Video Format: RGB32 (656x592)

Try set to RGB32 (1056x992)
Current Video Format: RGB32 (1056x992)

Try set to RGB32 (1156x1092)
Current Video Format: RGB32 (1056x992)

Stefan Geissler
June 24, 2014, 08:37:50
Hi

In one of my earlier posts to you, I showed the "VideoFormatDesc" to you. It has a member, that shows the steps you can set.

356 / 8 = 44,5. Therefore this is invalid.

I guess, this answers your question.

yan_zhao_ep
June 24, 2014, 13:46:27
I see, thanks, sorry I missed your earlier replay.