This short section shows how to capture and display a live image together with the output of some statistical information with this interface on Windows®.
The complete source code can be found in the examples section: ContinuousCapture.c (for the GenICam™ interface please refer to ContinuousCaptureGenICam.c instead).
First the library is initialized and a device is opened:
#define END_APPLICATION \
printf( "Press any key to end the application.\n" ); \
getch(); \
return 0; \
{
printf( "DMR_Init failed (code: %d)\n", result );
END_APPLICATION;
}
{
printf( "DMR_GetDevice failed (code: %d)\n", result );
END_APPLICATION;
}
if( ( hPropInterfaceLayout = getDeviceProp( hDevice ,
"InterfaceLayout" ) ) !=
INVALID_ID )
{
}
{
printf( "DMR_OpenDevice failed (code: %d)\n", result );
END_APPLICATION;
}
@ DMR_NO_ERROR
The function call was executed successfully.
Definition mvDriverBaseEnums.h:2603
@ dmdsmSerial
Searches for a device with a certain serial number.
Definition mvDeviceManager.h:528
@ dilGenICam
A GenICamâ„¢ like interface layout shall be used.
Definition mvDriverBaseEnums.h:2150
MVDMR_API TDMR_ERROR DMR_CALL DMR_Init(HDMR *pHDmr)
Initialises the library.
Definition mvDeviceManager.cpp:1137
MVDMR_API TDMR_ERROR DMR_CALL DMR_OpenDevice(HDEV hDev, HDRV *pHDrv)
Initialises a device.
Definition mvDeviceManager.cpp:1516
MVDMR_API TDMR_ERROR DMR_CALL DMR_GetDevice(HDEV *pHDev, TDMR_DeviceSearchMode searchMode, const char *pSearchString, unsigned int devNr, char wildcard)
Tries to locate a certain device in the system which matches the input criteria.
Definition mvDeviceManager.cpp:1379
const int INVALID_ID
A constant to check for an invalid ID returned from the property handling module.
Definition mvPropHandlingDatatypes.h:62
In any thread function the handle to the device (HDEV) and the handle to the devices interface (HDRV) can now be used to capture images:
{
printf(
"DMR_ImageRequestSingle: Unexpected error(code: %d(%s))\n", result,
DMR_ErrorCodeToString( result ) );
}
while( !s_boTerminated )
{
{
{
}
else
{
printf( "DMR_GetImageRequestBuffer: ERROR! Code %d\n", result );
}
}
else
{
printf( "DMR_ImageRequestWaitFor: ERROR! Code %d\n", result );
}
}
@ DEV_NO_FREE_REQUEST_AVAILABLE
The user requested a new image, but no free Request object is available to process this request.
Definition mvDriverBaseEnums.h:2713
MVDMR_API TDMR_ERROR DMR_CALL DMR_ImageRequestSingle(HDRV hDrv, int requestCtrl, int *pRequestUsed)
Sends an image request to the device driver.
Definition mvDeviceManager.cpp:2663
MVDMR_API TDMR_ERROR DMR_CALL DMR_ImageRequestUnlock(HDRV hDrv, int requestNr)
Unlocks the request for the driver again.
Definition mvDeviceManager.cpp:2727
MVDMR_API const char *DMR_CALL DMR_ErrorCodeToString(int errorCode)
Returns a string representation of a given error code.
Definition mvDeviceManager.cpp:5383
MVDMR_API TDMR_ERROR DMR_CALL DMR_GetImageRequestBuffer(HDRV hDrv, int requestNr, ImageBuffer **ppBuffer)
Returns the ImageBuffer of the desired request.
Definition mvDeviceManager.cpp:3732
MVDMR_API TDMR_ERROR DMR_CALL DMR_ImageRequestWaitFor(HDRV hDrv, int timeout_ms, int queueNr, int *pRequestNr)
Waits for a request object to become ready.
Definition mvDeviceManager.cpp:2767