For those of you who just want to jump in, here are the steps required to get you running. If you need more details, refer to the example code in Section 5.0.
#include "C:\Aptina Imaging\include\midlib2.h"
mi_camera_t *cameras[MI_MAX_CAMERAS]; //Array of cameras found
mi_s32 nNumCameras; //Actual number of cameras found
mi_s32 retValue; //Function error return value
mi_u8 *pCameraBuff; //Buffer to store image data
//Open a camera, providing either a specific sensor data file or a directory
retValue = mi_OpenCameras(cameras,&nNumCameras,mi_SensorData());
if (nNumCameras == 0) exit();
//Allocate the buffer to store the data, you must use the size that is
//computed for the particular camera, it may be larger than width*height
pCameraBuff = (mi_u8*)malloc(cameras[0]>sensor>bufferSize);
//"Turn on" the camera
mi_startTransport(cameras[0]);
//Grab a frame of data, buffer size is provided for error checking only
retValue = mi_grabFrame(cameras[0], pCameraBuff,
cameras[0]>sensor>bufferSize);
//Verify that we got a "good" frame before displaying data
while (retValue != MI_CAMERA_SUCCESS)
{
retValue = mi_grabFrame(cameras[0], pCameraBuff,
cameras[0]>sensor>bufferSize);
}
//[Insert display code here]
//"Turn off" the camera
mi_stopTransport(cameras[0]);
mi_CloseCameras();
add midlib2.lib to your project, for linking
That's it you're ready to go!
General
Content
Integrations
Add Comment