资源简介

MATRIX VISION品牌相机(mvIMPACT驱动) SDK调用例程,实现自由采集、软触发、硬触发模式,经工业项目测试。

资源截图

代码片段和文件信息

#include “StdAfx.h“
#include “MvCamera.h“

MvCamera::MvCamera(void)
{
m_pMgr = new DeviceManager();
m_maxCount = 3;
m_isopen = false;
m_isgrab = false;
}

MvCamera::~MvCamera(void)
{
if (m_isopen)
{
CloseCamera();
}
if (m_pMgr != NULL)
{
delete m_pMgr;
m_pMgr = NULL;
}
}

long MvCamera::GetCameraList(vector& camlist)
{
camlist.clear();
int devCnt = m_pMgr->deviceCount();
if (devCnt > 0)
{
for(int i = 0; i < devCnt; i++ )
{
Device* pDev = m_pMgr->getDevice(i);
if( pDev )
{
string sn = pDev->serial.read();
camlist.push_back(sn);
}
}
}

return devCnt;
}

long MvCamera::OpenCamera(string sn)
{
if (sn.length() > 1)
{
m_pDev = m_pMgr->getDeviceBySerial(sn);
if(m_pDev)
{
m_pDev->interfaceLayout.write(dilGenICam);
m_pDev->acquisitionstartStopBehaviour.write( assbUser );
m_pDev->userControlledImageProcessingEnable.write(bTrue);

m_pDev->open();
m_isopen = true;


//抓图操作的接口类
m_function = new FunctionInterface(m_pDev);
m_acquisitionControl = new AcquisitionControl( m_pDev );

m_analogControl = new AnalogControl( m_pDev );
m_imageFormatControl = new ImageFormatControl( m_pDev );
m_imagedestination = new ImageDestination( m_pDev );
m_systemSetting = new SystemSettings(m_pDev);


//设置图像对列
m_maxCount = m_acquisitionControl->mvAcquisitionMemoryMaxframeCount.read();
m_systemSetting->requestCount.write(m_maxCount);
BasicDeviceSettings pBasicDeviceSettings(m_pDev);                  
PropertyI timeOutProp = pBasicDeviceSettings.imageRequestTimeout_ms;
timeOutProp.write(0);

SetGrabMode(MV_Software);

StartAcquire();

return 0;
}
}

return -1;
}

long MvCamera::CloseCamera()
{
if(m_isgrab) StopAcquire();
if(m_isopen)
{
if(m_imagedestination != NULL)
{
delete m_imagedestination;
m_imagedestination = NULL;
}

if(m_imageFormatControl != NULL)
{
delete m_imageFormatControl;
m_imageFormatControl = NULL;
}

if(m_analogControl != NULL)
{
delete m_analogControl;
m_analogControl = NULL;
}

if(m_acquisitionControl != NULL)
{
delete m_acquisitionControl;
m_acquisitionControl = NULL;
}

if(m_function != NULL)
{
delete m_function;
m_function = NULL;
}
if(m_systemSetting != NULL)
{
delete m_systemSetting;
m_systemSetting = NULL;
}
m_pDev->close();
m_isopen = false;
}

return 0;
}

long MvCamera::GrabOne(void* pImageData)
{
if(m_isopen)
{
if(!m_isgrab)
{
m_function->imageRequestReset( 0 0 );

int icount = m_maxCount;
while( static_cast( m_function->imageRequestSingle() )  == DMR_NO_ERROR ) 
{
if (icount-- < 0)
{
return -1;
}
};

//开始采集
StartAcquire();

}

if(m_isgrab)
{
int requestNr = INVALID_ID;

//软触发
if((m_GrabMode == MV_Software))
{

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-09-27 15:34  mvCameraTest01\
     目录           0  2018-11-22 14:09  mvCameraTest01\Release\
     文件      140288  2018-11-22 14:09  mvCameraTest01\Release\mvCameraTest01.exe
     文件     2649088  2018-11-22 14:09  mvCameraTest01\Release\mvCameraTest01.pdb
     目录           0  2018-11-22 14:09  mvCameraTest01\mvCameraTest01\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\Driverbase\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\Driverbase\Include\
     文件        9998  2018-11-07 09:15  mvCameraTest01\mvCameraTest01\MV(2.29)\include\Driverbase\Include\mvCustomCommandDataTypes.h
     文件      251138  2018-11-07 09:15  mvCameraTest01\mvCameraTest01\MV(2.29)\include\Driverbase\Include\mvDriverbaseEnums.h
     文件        1712  2018-11-07 09:20  mvCameraTest01\mvCameraTest01\MV(2.29)\include\Driverbase\Include\mvVersionInfo.h
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\FirmwareUpdates\
     目录           0  2018-11-22 14:55  mvCameraTest01\mvCameraTest01\MV(2.29)\include\FirmwareUpdates\mvBlueCOUGAR\
     目录           0  2018-11-22 14:55  mvCameraTest01\mvCameraTest01\MV(2.29)\include\FirmwareUpdates\mvBlueFOX\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvGigECaptureDriver(x64)\
     文件        2575  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvGigECaptureDriver(x64)\mvGigECapture.inf
     文件       43344  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvGigECaptureDriver(x64)\mvGigECapture.sys
     文件        8046  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvGigECaptureDriver(x64)\mvGigECapture_amd64.cat
     文件        1647  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvGigECaptureDriver(x64)\mvGigECapturem.inf
     文件        7641  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvGigECaptureDriver(x64)\mvGigECapturem_amd64.cat
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\amd64\
     文件     1721576  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\amd64\WdfCoInstaller01009.dll
     文件       76384  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\amd64\libusb0.dll
     文件       99128  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\amd64\libusbK.dll
     文件       45904  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\amd64\libusbK.sys
     文件       11687  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\mvUSB3Vision.cat
     文件        5664  2018-11-07 09:16  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\mvUSB3Vision.inf
     目录           0  2018-11-20 13:58  mvCameraTest01\mvCameraTest01\MV(2.29)\include\KernelDrivers\mvUSB3Vision(x64)\x86\
............此处省略623个文件信息

评论

共有 条评论