
Machine Vision Camera SDK (C) Developer Guide
int i = 0;
if (m_stDevList.nDeviceNum == 0)
{
printf("no camera found!\n");
return;
}
//Select the first found online device and create device handle
int nDeviceIndex = 0;
MV_CC_DEVICE_INFO m_stDevInfo = {0};
memcpy(&m_stDevInfo, m_stDevList.pDeviceInfo[nDeviceIndex],
sizeof(MV_CC_DEVICE_INFO));
nRet = MV_CC_CreateHandle(&m_handle, &m_stDevInfo);
if (MV_OK != nRet)
{
printf("error: CreateHandle fail [%x]\n", nRet);
return;
}
else
{
unsigned int nAccessMode = MV_ACCESS_Exclusive;
unsigned short nSwitchoverKey = 0;
//Connect device
nRet = MV_CC_OpenDevice(m_handle, nAccessMode, nSwitchoverKey);
if (MV_OK != nRet)
{
printf("error: OpenDevice fail [%x]\n", nRet);
return;
}
//...other processing
}
//Get basic image information
MV_IMAGE_BASIC_INFO mstruBasicInfo = {0};
nRet = MV_CC_GetImageInfo(m_handle, &mstruBasicInfo);
if (MV_OK != nRet)
{
printf("error: GetImageInfo fail [%x]\n", nRet);
return;
}
//...other processing
//Shut device and release resource
nRet = MV_CC_CloseDevice(m_handle);
if (MV_OK != nRet)
{
141



































































































































































































































































































































































































