PDA

View Full Version : Software trigger with color camera DFK42BUC03



Filou
April 1, 2014, 09:13:44
Hi,

I'm using the VS C++ 2010 for development, and i'm looking vailny for getting a picture from my two cameras. So I have to manage the software trigger for this purpose. Is there any kind of code dealing with this situation ?

I'm looking forward for some help,

Regards,

Stefan Geissler
April 1, 2014, 09:37:40
Please look at http://www.theimagingsourceforums.com/showthread.php?325022-Software-trigger-with-camera-DFK-42BUC03&p=40202&posted=1#post40202

Filou
May 2, 2014, 09:39:22
Hi,

I'm struggling to write code in C++ for triggering my camera (dfk 42BUC03). Indeed, i'm not using a MFC application, I'm using a console with openCV.
The example I've got before didn't help me enough.

I need simply to enable trigger :

void Camera::FindPropertyInterfaces()
{
//m_pTriggerEnable = NULL;
m_pSoftwareTrigger = NULL;

if( m_cGrabber.isDevValid() )
{
// Query the trigger enable interface first.
tIVCDPropertyItemsPtr pItems = m_cGrabber.getAvailableVCDProperties();
// If the camera supports trigger, query the Sofware Trigger interface.
pItems->findInterfacePtr(VCDID_TriggerMode, VCDElement_SoftwareTrigger, m_pSoftwareTrigger );
if( m_pSoftwareTrigger == NULL )
{
std::cout << "The current device does not support software triggering! \n" << std::endl;
}

}
}

Thanks a lot,

Best regards

Stefan Geissler
May 5, 2014, 10:14:13
Hi

you got it nearly. After you queried the Software trigger, you can use it with its "push()" member. However, here are two functions, that may help:



bool Is_Trigger_Software_Trigger_Available(Grabber* pGrabber)
{
bool bResult = false;
if( pGrabber->isDevValid() )
{
tIVCDButtonPropertyPtr pButtonItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_TriggerMode, VCDElement_SoftwareTrigger ,pButtonItf);

if( pButtonItf != NULL )
{
bResult = true;
}
}

return bResult;
}



void Push_Trigger_Software_Trigger(Grabber* pGrabber)
{
if( pGrabber->isDevValid() )
{
tIVCDButtonPropertyPtr pButtonItf;
tIVCDPropertyItemsPtr pItems = pGrabber->getAvailableVCDProperties();
pItems->findInterfacePtr(VCDID_TriggerMode, VCDElement_SoftwareTrigger ,pButtonItf);

if( pButtonItf != NULL )
{
pButtonItf->push();
}
}
}


The second one it the interesting one for you. You use it:

Push_Trigger_Software_Trigger(&m_cGrabber);

Filou
May 6, 2014, 08:27:17
Dear Stephan,

Thank you very much for answering me. I still have a question if it doesn't bother you. Is it possible to enable the trigger without using the SDK ? especially for use under Linux ?

Best regards,

Stefan Geissler
May 6, 2014, 11:35:36
Hello

For Linux support, please look at https://github.com/TheImagingSource

I must admit, I did not test trigger and software trigger on Linux on my own. It should be possible.

Filou
May 23, 2014, 13:21:44
Hello

For Linux support, please look at https://github.com/TheImagingSource

I must admit, I did not test trigger and software trigger on Linux on my own. It should be possible.

Dear Stefan,

Thank you a lot for your support.
Could you please verify the attached code and let me know if it could work. I still have a problem to fix the software trigger for my two cameras. I would like to have two differents windows and by clicking on software trigger button, the two cameras snap the images.

Thank you again,

Kin Regards

Stefan Geissler
June 4, 2014, 09:02:01
Hello

Sorry for the late answer.

You did not add the Listener.cpp to the zip file, therefore, I am concerned about

// Add the CListener object to the the Grabber object.
m_cGrabber1.addListener(&m_cListener);
m_cGrabber2.addListener(&m_cListener);

You may create two listener instances, so you write

// Add the CListener object to the the Grabber object.
m_cGrabber1.addListener(&m_cListener1);
m_cGrabber2.addListener(&m_cListener2);

Please keep in mind, the cListener2.frameReady() is not called, if a previous call of it is still running.