Functions | |
| BOOL | dvcResetExpose (HANDLE hDevice) |
| BOOL | dvcSetCallback (HANDLE hDevice, dvcCallbackProcPtr fCallbackProcPtr, void *inUserData) |
| BOOL | dvcSetExposeCompleteEvent (HANDLE hDevice, HANDLE hEvent) |
| BOOL | dvcSetReadCompleteEvent (HANDLE hDevice, HANDLE hEvent) |
| BOOL | dvcSnapShot (HANDLE hDevice, double dExpose, Int32 eTrigger) |
| BOOL | dvcStartSequence (HANDLE hDevice, UInt32 frames) |
| BOOL | dvcStartSequenceEx (HANDLE hDevice, UInt32 frames, Int32 eTrigger) |
| BOOL | dvcStopSequence (HANDLE hDevice) |
| BOOL | dvcTakePicture (HANDLE hDevice) |
| BOOL dvcResetExpose | ( | HANDLE | hDevice | ) |
| hDevice | returned from dvcOpenCamera(). |
| BOOL dvcSetCallback | ( | HANDLE | hDevice, | |
| dvcCallbackProcPtr | fCallbackProcPtr, | |||
| void * | inUserData | |||
| ) |
Set an application function to be called after each image is transferred. Enables multithreaded service for image captures.
| hDevice | camera handle returned from dvcOpenCamera(). | |
| fCallbackProcPtr | is the address of a function called after an image is transferred to the host memory. | |
| inUserData | is a pointer to an application context returned as an element in the pCallBackProcPtr argument. |
The argument to the callback function is a pointer to a dvcCallbackData structure defined as;
typedef struct _dvcCallback_t { HANDLE hDevice ; // Handle to camera USHORT *pImageBuffer ; // Pointer to raw image data UInt32 ulWidth ; // width of image data UInt32 ulHeight ; // height of image data UInt32 ulFrame ; // frame count double dTimeStamp ; // time image was captured void *pUserData ; // application data ImageMetaData sMeta ; // meta with associated image buffer } dvcCallbackData, *dvcCallbackDataP ;
Example:
void myFrameService( void *pVData ) { dvcCallbackDataP pCbData = (dvcCallbackDataP)pVData ; dvcPrintf(0,"Image number %d w %d x h %d pix(0,0) %d\n", pCbData->ulFrame, pCbData->ulWidth, pCbData->ulHeight, *pCbData->pImageBuffer); } void myStartTransfers( HANDLE hDevice, void *myData ) { Int32 frame ; dvcStopSequence(hDevice) ; // Stop any existing captures.. dvcSetCallback(hDevice, (dvcCallbackProcP) myFrameService, myData); frame = dvcGetFrameCount(hDevice); dvcStartSequence(hDevice, 0) ; while( dvcGetFrameCount(hDevice) < frame + 10 ) ; dvcStopSequence(hDevice); }
| BOOL dvcSetExposeCompleteEvent | ( | HANDLE | hDevice, | |
| HANDLE | hEvent | |||
| ) |
installs an event handle signaled after an exposure completes.
| hDevice | handle returned from dvcOpenCamera(). | |
| hEvent | handle created with the Windows API CreateEvent(). |
SetEvent(hEvent)
| BOOL dvcSetReadCompleteEvent | ( | HANDLE | hDevice, | |
| HANDLE | hEvent | |||
| ) |
installs an event handle signaled after an image transfer completes.
| hDevice | handle returned from dvcOpenCamera(). | |
| hEvent | handle created with the Windows API CreateEvent(). |
SetEvent(hEvent)
| BOOL dvcSnapShot | ( | HANDLE | hDevice, | |
| double | dExpose, | |||
| Int32 | eTrigger | |||
| ) |
Capture a single frame with a given exposure.
| hDevice | camera handle returned from dvcOpenCamera(). | |
| dExpose | time in milliseconds to expose the CCD. | |
| eTrigger | controls the trigger type ( |
| BOOL dvcStartSequence | ( | HANDLE | hDevice, | |
| UInt32 | frames | |||
| ) |
Start captures with using the camera's internal timing for exposure.
| hDevice | camera handle returned from dvcOpenCamera(). | |
| frames | the number of frames to capture or 0 to capture indefinitely. |
| BOOL dvcStartSequenceEx | ( | HANDLE | hDevice, | |
| UInt32 | frames, | |||
| Int32 | eTrigger | |||
| ) |
Start captures and return immediately. To determine when an exposure has completed, use dvcWaitExpose(), and to determine when data has been transferred to the host, use dvcWaitImage(). Data transfers from the camera to the API occur always to buffers allocated and managed internally by the API. To transfer raw image data to an application buffer, use the functions dvcReadImage() or dvcReadImageEx().
| hDevice | camera handle returned from dvcOpenCamera(). | |
| frames | the number of frames to capture or 0 to capture indefinitely. | |
| eTrigger | optionally enables external triggering of the start or exposure. |
typedef enum { dvcTriggerTimed = 0, // internal camera timing controls exposure dvcTriggerBulb, // external TTL controls exposure dvcTriggerStrobe // external TTL starts, camera controls exposure } dvcTriggerModes
BOOL dvcGrab( HANDLE hDevice, double dMilliSeconds, USHORT *myBuffer, Int32 width, Int32 height ) { BOOL bOK = FALSE ; double dTimeout = dvcGetExposeMsec(hDevice) // Expose time + dvcTimeToReadImage(hDevice) // Time to transfer + 100.0 ; // Allow for 100 millisecond overhead.. if(!dvcStartSequenceEx(hDevice,1,dvcTriggerTimed)) { dvcPrintf(0,"Start Error!\n"); return FALSE ; } if(!dvcWaitImage(hDevice), dTimeout )) { // Handle time out.. dvcPrintf(0,"Timeout!\n"); bOK = FALSE ; } else if(!dvcReadImage(hDevice,myBuffer,0,0,width,height)) { // Handle read error dvcPrintf(0,"Read Error!\n"); bOK = FALSE ; } else bOK = TRUE ; // Stop and release any resources. dvcStopSequence(hDevice); return bOK ; }
| BOOL dvcStopSequence | ( | HANDLE | hDevice | ) |
Stop a capture sequence and releases any system resources.
| hDevice | camera handle returned from dvcOpenCamera(). |
| BOOL dvcTakePicture | ( | HANDLE | hDevice | ) |
Capture a single image and wait for completion.
| hDevice | camera handle returned from dvcOpenCamera(). |