xiAPI stands for XIMEA Application Programming Interface.
It is a new common interface for all XIMEA cameras, and represents a simplified version of generic M3API.
xiAPI Manual
Camera Trigger and Synchronization Signals
Image Data Flow
Sample code
API is a software interface between the camera system driver and application.
xiapi32.dll
or xiapi64.dll
/usr/lib/libm3api.so
It is possible to enumerate all cameras from multiple processes. It is possible to use xiGetParamInfoString to obtain SN, User_ID or Model name from any process or thread. However the camera can be opened only once by xiOpenDevice. If camera is opened by one process or thread - other processes can't open this camera until previous process closes the handle by xiCloseDevice or is finished by operating system.
Here follows a sample code which captures one raw image data from the sensor without any post-processing.
Exposure time is set 10 ms.
#include "..\include\xiApi.h"
#include <memory.h>
#define HandleResult(res,place) if (res!=XI_OK) {printf("Error after %s (%d)",place,res);goto finish;}
HANDLE xiH = NULL;
XI_RETURN stat = XI_OK;
// image buffer
XI_IMG image;
memset(&image,0,sizeof(image));
image.size = sizeof(XI_IMG);
// Retrieving a handle to the camera device
stat = xiOpenDevice(0, &xiH);
HandleResult(stat,"xiOpenDevice");
// Setting Exposure Time parameter (10ms)
stat = xiSetParamInt(xiH, XI_PRM_EXPOSURE, 10000); // microseconds
HandleResult(stat,"xiSetParam (exposure time set)");
// Note:
// The default parameters of each camera might be different
// in different API versions, please set all parameters
// expected by your application to required value.
// Start acquisition
stat = xiStartAcquisition(xiH);
HandleResult(stat,"xiStartAcquisition");
// getting image from camera
stat = xiGetImage(xiH, 1000, &image);
HandleResult(stat,"xiGetImage");
printf("OK - Got one image (%dx%d) from camera\n", image.width, image.height);
finish:
// Close device
if (xiH) xiCloseDevice(xiH);
XIMEA API Sample With Start Stop Acquisition
The core of xiAPI are the following 6 functions, which allow to control most of the camera functionality.
// open interface
XI_RETURN xiOpenDevice(IN DWORD DevId, OUT PHANDLE hDevice);
// set parameter
XI_RETURN xiSetParam(IN HANDLE hDevice, const char* prm, void* val, DWORD size, PRM_TYPE type);
// get parameter
XI_RETURN xiGetParam(IN HANDLE hDevice, const char* prm, void* val, DWORD * size, PRM_TYPE * type);
// start acquisition
XI_RETURN xiStartAcquisition(IN HANDLE hDevice);
// get next image from queue
XI_RETURN xiGetImage(IN HANDLE hDevice, IN DWORD timeout_ms, OUT LPXI_IMG img);
// close interface
XI_RETURN xiCloseDevice(IN HANDLE hDevice);
xiAPI allows to process already captured and stored images using Offline Processing. Please read more at xiAPI Offline Processing.
Handling of image buffers in xiAPI is simplified.
It does not allow allocating of buffers by application or controlling each image buffer independently.
However, if your application requires full control over buffering, the standard GenTL acquisition interface combined with xiAPI parameters interface can be used.
Multiple GenTL functions are implemented under xiAPI library, such as DSAnnounceBuffer, DSQueueBuffer.
You can find the source file for sample application - xiAPI-capture-50-images-gentl-main.cpp.
Full example is included in Windows SP or in Linux SP - within the folder Examples/xiAPI/capture-50-images-gentl
xiAPI acquisition over GenTL is supported for all PCIe interface models (xiX, xiB, xiT) and the most recent USB3 interface (xiC) camera models.