#include "cmvcamera.h"
CMvCamera::CMvCamera()
{
m_hDevHandle = MV_NULL;
}
CMvCamera::~CMvCamera()
{
if (m_hDevHandle)
{
MV_CC_DestroyHandle(m_hDevHandle);
m_hDevHandle = MV_NULL;
}
}
// ch:获取SDK版本号 | en:Get SDK Version
int CMvCamera::GetSDKVersion()
{
return MV_CC_GetSDKVersion();
}
// ch:枚举设备 | en:Enumerate Device
int CMvCamera::EnumDevices(unsigned int nTLayerType, MV_CC_DEVICE_INFO_LIST* pstDevList)
{
return MV_CC_EnumDevices(nTLayerType, pstDevList);
}
// ch:判断设备是否可达 | en:Is the device accessible
bool CMvCamera::IsDeviceAccessible(MV_CC_DEVICE_INFO* pstDevInfo, unsigned int nAccessMode)
{
return MV_CC_IsDeviceAccessible(pstDevInfo, nAccessMode);
}
// ch:打开设备 | en:Open Device
int CMvCamera::Open(MV_CC_DEVICE_INFO* pstDeviceInfo)
{
if (MV_NULL == pstDeviceInfo)
{
return MV_E_PARAMETER;
}
if (m_hDevHandle)
{
return MV_E_CALLORDER;
}
int nRet = MV_CC_CreateHandle(&m_hDevHandle, pstDeviceInfo);
if (MV_OK != nRet)
{
return nRet;
}
nRet = MV_CC_OpenDevice(m_hDevHandle);
if (MV_OK != nRet)
{
MV_CC_DestroyHandle(m_hDevHandle);
m_hDevHandle = MV_NULL;
}
return nRet;
}
// ch:关闭设备 | en:Close Device
int CMvCamera::Close()
{
if (MV_NULL == m_hDevHandle)
{
return MV_E_HANDLE;
}
MV_CC_CloseDevice(m_hDevHandle);
int nRet = MV_CC_DestroyHandle(m_hDevHandle);
m_hDevHandle = MV_NULL;
return nRet;
}
// ch:判断相机是否处于连接状态 | en:Is The Device Connected
bool CMvCamera::IsDeviceConnected()
{
return MV_CC_IsDeviceConnected(m_hDevHandle);
}
// ch:注册图像数据回调 | en:Register Image Data CallBack
int CMvCamera::RegisterImageCallBack(void(__stdcall* cbOutput)(unsigned char * pData, MV_FRAME_OUT_INFO_EX* pFrameInfo, void* pUser), void* pUser)
{
return MV_CC_RegisterImageCallBackEx(m_hDevHandle, cbOutput, pUser);
}
// ch:开启抓图 | en:Start Grabbing
int CMvCamera::StartGrabbing()
{
return MV_CC_StartGrabbing(m_hDevHandle);
}
// ch:停止抓图 | en:Stop Grabbing
int CMvCamera::StopGrabbing()
{
return MV_CC_StopGrabbing(m_hDevHandle);
}
// ch:主动获取一帧图像数据 | en:Get one frame initiatively
int CMvCamera::GetImageBuffer(MV_FRAME_OUT* pFrame, int nMsec)
{
return MV_CC_GetImageBuffer(m_hDevHandle, pFrame, nMsec);
}
// ch:释放图像缓存 | en:Free image buffer
int CMvCamera::FreeImageBuffer(MV_FRAME_OUT* pFrame)
{
return MV_CC_FreeImageBuffer(m_hDevHandle, pFrame);
}
// ch:设置显示窗口句柄 | en:Set Display Window Handle
int CMvCamera::DisplayOneFrame(MV_DISPLAY_FRAME_INFO* pDisplayInfo)
{
return MV_CC_DisplayOneFrame(m_hDevHandle, pDisplayInfo);
}
// ch:设置SDK内部图像缓存节点个数 | en:Set the number of the internal image cache nodes in SDK
int CMvCamera::SetImageNodeNum(unsigned int nNum)
{
return MV_CC_SetImageNodeNum(m_hDevHandle, nNum);
}
// ch:获取设备信息 | en:Get device information
int CMvCamera::GetDeviceInfo(MV_CC_DEVICE_INFO* pstDevInfo)
{
return MV_CC_GetDeviceInfo(m_hDevHandle, pstDevInfo);
}
// ch:获取GEV相机的统计信息 | en:Get detect info of GEV camera
int CMvCamera::GetGevAllMatchInfo(MV_MATCH_INFO_NET_DETECT* pMatchInfoNetDetect)
{
if (MV_NULL == pMatchInfoNetDetect)
{
return MV_E_PARAMETER;
}
MV_CC_DEVICE_INFO stDevInfo = {0};
GetDeviceInfo(&stDevInfo);
if (stDevInfo.nTLayerType != MV_GIGE_DEVICE)
{
return MV_E_SUPPORT;
}
MV_ALL_MATCH_INFO struMatchInfo = {0};
struMatchInfo.nType = MV_MATCH_TYPE_NET_DETECT;
struMatchInfo.pInfo = pMatchInfoNetDetect;
struMatchInfo.nInfoSize = sizeof(MV_MATCH_INFO_NET_DETECT);
memset(struMatchInfo.pInfo, 0, sizeof(MV_MATCH_INFO_NET_DETECT));
return MV_CC_GetAllMatchInfo(m_hDevHandle, &struMatchInfo);
}
// ch:获取U3V相机的统计信息 | en:Get detect info of U3V camera
int CMvCamera::GetU3VAllMatchInfo(MV_MATCH_INFO_USB_DETECT* pMatchInfoUSBDetect)
{
if (MV_NULL == pMatchInfoUSBDetect)
{
return MV_E_PARAMETER;
}
MV_CC_DEVICE_INFO stDevInfo = {0};
GetDeviceInfo(&stDevInfo);
if (stDevInfo.nTLayerType != MV_USB_DEVICE)
{
return MV_E_SUPPORT;
}
MV_ALL_MATCH_INFO struMatchInfo = {0};
struMatchInfo.nType = MV_MATCH_TYPE_USB_DETECT;
struMatchInfo.pInfo = pMatchInfoUSBDetect;
struMatchInfo.nInfoSize = sizeof(MV_MATCH_INFO_USB_DETECT);
memset(struMatchInfo.pInfo, 0, sizeof(MV_MATCH_INFO_USB_DETECT));
return MV_CC_GetAllMatchInfo(m_hDevHandle, &struMatchInfo);
}
// ch:获取和设置Int型参数,如 Width和Height,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Int type parameters, such as Width and Height, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetIntValue(IN const char* strKey, OUT MVCC_INTVALUE_EX *pIntValue)
{
return MV_CC_GetIntValueEx(m_hDevHandle, strKey, pIntValue);
}
int CMvCamera::SetIntValue(IN const char* strKey, IN int64_t nValue)
{
return MV_CC_SetIntValueEx(m_hDevHandle, strKey, nValue);
}
// ch:获取和设置Enum型参数,如 PixelFormat,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Enum type parameters, such as PixelFormat, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetEnumValue(IN const char* strKey, OUT MVCC_ENUMVALUE *pEnumValue)
{
return MV_CC_GetEnumValue(m_hDevHandle, strKey, pEnumValue);
}
int CMvCamera::SetEnumValue(IN const char* strKey, IN unsigned int nValue)
{
return MV_CC_SetEnumValue(m_hDevHandle, strKey, nValue);
}
int CMvCamera::SetEnumValueByString(IN const char* strKey, IN const char* sValue)
{
return MV_CC_SetEnumValueByString(m_hDevHandle, strKey, sValue);
}
int CMvCamera::GetEnumEntrySymbolic(IN const char* strKey, IN MVCC_ENUMENTRY* pstEnumEntry)
{
return MV_CC_GetEnumEntrySymbolic(m_hDevHandle, strKey, pstEnumEntry);
}
// ch:获取和设置Float型参数,如 ExposureTime和Gain,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Float type parameters, such as ExposureTime and Gain, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetFloatValue(IN const char* strKey, OUT MVCC_FLOATVALUE *pFloatValue)
{
return MV_CC_GetFloatValue(m_hDevHandle, strKey, pFloatValue);
}
int CMvCamera::SetFloatValue(IN const char* strKey, IN float fValue)
{
return MV_CC_SetFloatValue(m_hDevHandle, strKey, fValue);
}
// ch:获取和设置Bool型参数,如 ReverseX,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件
// en:Get Bool type parameters, such as ReverseX, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetBoolValue(IN const char* strKey, OUT bool *pbValue)
{
return MV_CC_GetBoolValue(m_hDevHandle, strKey, pbValue);
}
int CMvCamera::SetBoolValue(IN const char* strKey, IN bool bValue)
{
return MV_CC_SetBoolValue(m_hDevHandle, strKey, bValue);
}
// ch:获取和设置String型参数,如 DeviceUserID,详细内容参考SDK安装目录下的 MvCameraNode.xlsx 文件UserSetSave
// en:Get String type parameters, such as DeviceUserID, for details please refer to MvCameraNode.xlsx file under SDK installation directory
int CMvCamera::GetStringValue(IN const char* strKey, MVCC_STRINGVALUE *pStringValue)
{
return MV_CC_GetStringValue(m_hDevHandle, strKey, pStringValue);
}
int CMvCamera::SetStringValue(IN const char* strKey, IN const char* strValue)
{
return MV_CC_SetStringValue(m_
没有合适的资源?快使用搜索试试~ 我知道了~
Qt多线程实现海康工业相机图像采集+算法检测+OpenGLWidget实时显示
共664个文件
hpp:499个
h:126个
a:17个
需积分: 0 96 下载量 110 浏览量
2023-03-08
18:43:45
上传
评论 4
收藏 4.41MB ZIP 举报
温馨提示
本文使用了两个海康的工业相机进行图像采集,同样对应着两个图像采集线程和两个算法处理线程,主界面上使用了OpenGLWidget来显示图像,资源内容与我的文章 [(三)Qt多线程实现海康工业相机图像采集+算法检测+OpenGLWidget实时显示](https://blog.csdn.net/XCJandLL/article/details/129287191)内容一致,放在此处也是方便大家下载(百度网盘可免费下载,但是没开会员速度很慢呀~)
资源推荐
资源详情
资源评论
收起资源包目录
Qt多线程实现海康工业相机图像采集+算法检测+OpenGLWidget实时显示 (664个子文件)
libopencv_ts451.a 1.89MB
libopencv_core451.dll.a 1.66MB
libopencv_gapi451.dll.a 880KB
libopencv_stitching451.dll.a 737KB
libade.a 650KB
libopencv_dnn451.dll.a 547KB
libopencv_imgproc451.dll.a 481KB
libopencv_features2d451.dll.a 420KB
libopencv_video451.dll.a 388KB
libopencv_calib3d451.dll.a 352KB
libopencv_photo451.dll.a 328KB
libopencv_objdetect451.dll.a 321KB
libopencv_videoio451.dll.a 304KB
libopencv_highgui451.dll.a 297KB
libopencv_ml451.dll.a 272KB
libopencv_flann451.dll.a 255KB
libopencv_imgcodecs451.dll.a 230KB
OpenCVConfig.cmake 15KB
OpenCVModules.cmake 3KB
OpenCVModules-release.cmake 956B
OpenCVModules-debug.cmake 950B
OpenCVConfig-version.cmake 433B
cmvcamera.cpp 13KB
mainwindow.cpp 7KB
processingthread.cpp 3KB
camerathread.cpp 1KB
myglwidget.cpp 665B
main.cpp 183B
globalvar.cpp 96B
MvSdkExport.h 258KB
MvCameraControl.h 153KB
core_c.h 129KB
core_c.h 126KB
MvObsoleteInterfaces.h 121KB
CameraParams.h 83KB
msa_macros.h 82KB
msa_macros.h 81KB
types_c.h 72KB
types_c.h 70KB
kmeans_index.h 68KB
kmeans_index.h 66KB
imgproc_c.h 51KB
imgproc_c.h 50KB
dist.h 42KB
dist.h 40KB
ObsoleteCamParams.h 39KB
cvdef.h 35KB
cvdef.h 34KB
constants_c.h 31KB
constants_c.h 30KB
cv_cpu_helper.h 27KB
cv_cpu_helper.h 27KB
hierarchical_clustering_index.h 27KB
hierarchical_clustering_index.h 26KB
autotuned_index.h 21KB
kdtree_single_index.h 21KB
autotuned_index.h 21KB
kdtree_index.h 20KB
kdtree_single_index.h 20KB
kdtree_index.h 20KB
lsh_table.h 19KB
types_c.h 18KB
lsh_table.h 18KB
types_c.h 18KB
PixelType.h 16KB
lsh_index.h 16KB
result_set.h 15KB
lsh_index.h 15KB
result_set.h 15KB
index_testing.h 11KB
highgui_c.h 11KB
index_testing.h 11KB
highgui_c.h 10KB
any.h 9KB
any.h 8KB
cv_cpu_dispatch.h 8KB
cv_cpu_dispatch.h 8KB
MvErrorDefine.h 8KB
hdf5.h 7KB
hdf5.h 7KB
cmvcamera.h 7KB
allocator.h 6KB
all_indices.h 6KB
composite_index.h 6KB
allocator.h 6KB
nn_index.h 6KB
all_indices.h 6KB
composite_index.h 6KB
saving.h 6KB
nn_index.h 6KB
simplex_downhill.h 6KB
saving.h 6KB
videoio_c.h 6KB
simplex_downhill.h 6KB
videoio_c.h 6KB
calib3d_c.h 5KB
MvISPErrorDefine.h 5KB
calib3d_c.h 5KB
cap_ios.h 5KB
interface.h 5KB
共 664 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
电气徐小江
- 粉丝: 5719
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功