HomeSupportAPIs → M3API

M3API

M3API is deprecated since December 2011.

Please use xiAPI for new projects.

Architecture

API is software interface between application and camera driver. It contains of m3api.dll file.

Installation

To add M3API support please install XIMEA API Software Package to PC or CURRERA.

Sample

Following is sample of code, that captures 100 frames and process each of them.

// NB: For better readability - this sample does not contain
// any error handling. For proper implementation 
// please handle all returns from functions.
HANDLE    hMV = INVALID_HANDLE_VALUE;        
DWORD    devices, dwSerial;
int iExposure = 10000;
unsigned int uiMode = 0;
#define EXPECTED_FRAMES_COUNT 100

mmGetNumberDevices( szMM40_Name, &devices );
printf("Number of cameras found %d\n", devices);
mmGetDevice( 0, &dwSerial );
// get handle to device
mmInitialize( szMM40_Name, dwSerial, &hMV );
mmInitializeHardware( hMV );
mmSetMode( hMV, iExposure, uiMode, 0, 0, 0, 0 );
while(!mmIsSetModeComplete(hMV));

mmStartAcquisition( hMV );

// capture frame loop
while (int count++ < EXPECTED_FRAMES_COUNT)
{
      // wait for field comes from camera
      while ( MM40_OK != mmWaitForField( hMV, 1000 + iExposure/1000) ); 
      LPWORD pRawData=NULL;    
      mmAcquireField( hMV, (HANDLE*)&pRawData );
      mmUpdateBayerFrame( hMV, pRawData );
      //retrieves frame structure        
      MMGETFRAMEEX lpGF;
      mmRetrieveFrameBayerEx( hMV, &lpGF );
      // here application can process the received frame
      // ...
}                         
mmStopAcquisition( hMV ); //stops acquisition
mmUninitialize( hMV );