ruicosta
May 3, 2006, 20:28:10
I´m using the DMK21BF04 with external trigger. I have implemented the following steps:
....
- Setup the grabber.
- create the memory buffer:
code:
__________________________________________________ _______________________
grabber->setSinkType( FrameGrabberSink(
FrameGrabberSink::tFrameGrabberMode::eGRAB, DshowLib::eY8));
pMemBuffColl = grabber->newMemBufferCollection( 1 );
grabber->setActiveMemBufferCollection( pMemBuffColl );
__________________________________________________ _______________________
- Start the live video and enable trigger:
code:
________________________________________
grabber->setExternalTrigger(TRUE);
grabber->startLive(FALSE);
________________________________________
- Access the image data for image processing (executed on a thread):
code:
__________________________________________________ ____________________________
DShowLib::Grabber::tMemBufferPtr pBuffer1 = grabber->getActiveMemBuffer(); (1)
BYTE pbImgData = pBuffer1->getPtr(); (2)
__________________________________________________ ____________________________
If no trigger occured, when the program execute the instruction (2), the error debug window will appear and the program crash. If the trigger has occured before, the instruction (2) is executed and it works fine (i can change the image data).
Why i can´t get the buffer pointer when the buffer is empty ?
The is any procedure to verify is the buffer contain any image ?
Best regards
Rui Costa
....
- Setup the grabber.
- create the memory buffer:
code:
__________________________________________________ _______________________
grabber->setSinkType( FrameGrabberSink(
FrameGrabberSink::tFrameGrabberMode::eGRAB, DshowLib::eY8));
pMemBuffColl = grabber->newMemBufferCollection( 1 );
grabber->setActiveMemBufferCollection( pMemBuffColl );
__________________________________________________ _______________________
- Start the live video and enable trigger:
code:
________________________________________
grabber->setExternalTrigger(TRUE);
grabber->startLive(FALSE);
________________________________________
- Access the image data for image processing (executed on a thread):
code:
__________________________________________________ ____________________________
DShowLib::Grabber::tMemBufferPtr pBuffer1 = grabber->getActiveMemBuffer(); (1)
BYTE pbImgData = pBuffer1->getPtr(); (2)
__________________________________________________ ____________________________
If no trigger occured, when the program execute the instruction (2), the error debug window will appear and the program crash. If the trigger has occured before, the instruction (2) is executed and it works fine (i can change the image data).
Why i can´t get the buffer pointer when the buffer is empty ?
The is any procedure to verify is the buffer contain any image ?
Best regards
Rui Costa