PDA

View Full Version : Why i need to give sleep( ) after startlive() in DFK 33G445 camera model ?



vivek
February 3, 2016, 07:28:19
Hi all,

I have DFK 33G445 camera.I am giving hardware external trigger signal to the camera.If trigger signal is on , call startlive(). Only first image is taken.when i give next trigger signal, image is not captured.Image is captured only if give sleep(200) after startlive(). How many ms i have to give to sleep()?Please help in regard by sending some sample code.

Thanks and Regards
vivek

Stefan Geissler
February 3, 2016, 13:22:17
What are you doing? I do not understand your sequence.

From your other threads, I learned, you wanted to start the camera and stream images, if the Input is high.

Do you want to start a stream on Input?

Or do you want to capture one image per trigger signal? (if this, enable trigger, startlive the camera once. Fire trigger.)

vivek
February 4, 2016, 06:29:22
What are you doing? I do not understand your sequence.

From your other threads, I learned, you wanted to start the camera and stream images, if the Input is high.

Do you want to start a stream on Input?

Or do you want to capture one image per trigger signal? (if this, enable trigger, startlive the camera once. Fire trigger.)

Hi Stefan,

I'm using an external trigger. I had to use the Sleep command after grabber.startLive() or it does not capture the image for next trigger.Please find the code I had used below:

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
UINT ThreadProc(LPVOID lparam)
{
CCamera2* phandle = (CCamera2*)(lparam);

bool bResult = false;
long lInputState = 0;
phandle->m_pListener1->m_Image_Acquired = 1;

phandle->m_pInputRead = NULL;

tIVCDPropertyItemsPtr pItems = phandle->m_pGrabber1->getAvailableVCDProperties();

while(phandle->m_entry)
{
if(phandle->m_pGrabber1->isDevValid())
{
pItems->findInterfacePtr(VCDID_GPIO, VCDElement_GPIOIn ,phandle->m_pInput);

if( phandle->m_pInput != NULL)
{
pItems->findInterfacePtr(VCDID_GPIO, VCDElement_GPIORead ,phandle->m_pInputRead);
if( phandle->m_pInputRead != NULL)
{
bResult = true;
}
}
}

if(phandle->m_pInputRead != NULL )
{
phandle->m_pInputRead->push(); // Get the current value from the device
phandle->m_pInput->get_Value(&lInputState); // Now we read the value

if( lInputState == 1 )
{
if(phandle->m_pListener1->m_Image_Acquired == 1)
{
phandle->m_pListener1->m_Image_Acquired++;
phandle->m_pGrabber1->startLive(false);
Sleep(200);
}
}
else
{
if(phandle->m_pListener1->m_Image_Acquired == 0)
{
phandle->m_pGrabber1->stopLive();
phandle->m_pListener1->m_Image_Acquired = 1;

}
}
}
}

return 0;
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
I want to capture one image per trigger signal.

Stefan Geissler
February 4, 2016, 09:56:34
I want to capture one image per trigger signal.

ok. In this situation do:
m_pGrabber1->setExternalTrigger(true);
m_pGrabber1->startLive(false);

You also need a callback, as shown in the "callback" sample. But the sink->snapMode must be set to false.

You do not need to handle the GPIn at all for this.

vivek
February 11, 2016, 10:30:51
Hi Stefan,

It worked.Thanks

vivek