1.8安装相机SDK及测试

不同工业相机的sdk不同,可以到相应的官网下载,我使用的是大华相机和海康相机
一、大华相机 下载SDK:
官方下载地址:
推荐使用的是2.3.1的Linux的x86的版本
点击下载
安装:
将下载的压缩包用指令unzip 压缩,.run文件增加可执行权限,然后运行即可打开软件 。
解压:unzip
更改文件权限:chmod(这里是添加可执行权限)
使用root权限进行安装:sudo su
执行某个可执行程序,开始安装:sudo ./[name]
打开软件:找到软件的 .sh文件,从终端进入(运行run.sh)
安装默认位置:/opt//
【1.8安装相机SDK及测试】去/opt//看看安装好了没有
如果出现错误:
...Error in MD5 :isfrom
有可能是下载的文件数据损失了, 需要重新到官网下载
测试:
打开大华的软件:
/opt/DahuaTech/MVviewer/bin/run.sh
成功打开
在QT中使用大华相机
新建一个QT工程
导入的头文件和库:
.pro文件中输入下列代码
INCLUDEPATH +=/usr/local/include/ \/usr/local/include/opencv4/ \/usr/local/include/opencv4/opencv2LIBS +=/usr/local/lib/lib*
添加大华头文件和动态库:
刚才下载好的SDK在这个位置: 文件夹—其他位置—计算机 /opt//
将大华目录下的头文件和动态库 lib 复制到qt工程文件夹下
将这两个文件导入QT工程中:
在.pro文件中配置大华的环境
输入下列代码

1.8安装相机SDK及测试

文章插图
INCLUDEPATH +=./include \LIBS += -L/opt/DahuaTech/MVviewer/lib/ -lMVSDKLIBS += -L/opt/DahuaTech/MVviewer/lib/ -lImageConvertLIBS += -L/opt/DahuaTech/MVviewer/lib/ -lVideoRenderLIBS += -L/opt/DahuaTech/MVviewer/lib/GenICam/bin/Linux64_x64/ -lGCBase_gcc421_v3_0 -lGenApi_gcc421_v3_0 -lLog_gcc421_v3_0LIBS += -L/opt/DahuaTech/MVviewer/lib/GenICam/bin/Linux64_x64/ -llog4cpp_gcc421_v3_0 -lNodeMapData_gcc421_v3_0 -lXmlParser_gcc421_v3_0LIBS += -L/opt/DahuaTech/MVviewer/lib/GenICam/bin/Linux64_x64/ -lMathParser_gcc421_v3_0LIBS+=-L/opt/DahuaTech/MVviewer/lib -lMVSDK
添加测试代码
将我经常用的和src的文件复制到工程文件夹下 , 并将其导入Qt工程中(用下面的代码测试)
这个工程有video.h, video.cpp和main这三个文件
插入大华相机,运行 , 显示设备信息即成功
完成
二、海康相机 下载SDK:
官方下载地址:海康机器人-机器视觉-下载中心 ()
安装命令:
sudo apt install ./MVS-2.1.2....deb
打开SDK测试:终端输入:“/opt/MVS/bin/MVS.sh” qt中测试在QT中新建项目,将MVS文件中的文件复制到项目文件夹下pro文件:
在项目中添加库,选择外部库,然后选择库文件所在的路径下,选择opt/mvs/lib/64下的所有的 .so文件,一个一个添加
得到以下结果:DISTFILES += \lib/32/CommonParameters.ini \lib/32/MvProducerGEV.cti \lib/32/MvProducerU3V.cti \lib/32/libFormatConversion.so \lib/32/libMVGigEVisionSDK.so \lib/32/libMVGigEVisionSDK.so.4.1.2.2 \lib/32/libMVRender.so \lib/32/libMediaProcess.so \lib/32/libMvCameraControl.so \lib/32/libMvCameraControl.so.4.1.2.2 \lib/32/libMvCameraControlWrapper.so \lib/32/libMvCameraControlWrapper.so.1.0.1.0 \lib/32/libMvUsb3vTL.so \lib/32/libMvUsb3vTL.so.4.1.2.2 \lib/32/libavutil.so \lib/32/libswscale.so \lib/32/libusb-1.0.so.0 \lib/64/CommonParameters.ini \lib/64/MvProducerGEV.cti \lib/64/MvProducerU3V.cti \lib/64/libCLAllSerial_gcc447_v3_0.so \lib/64/libCLProtocol_gcc447_v3_0.so \lib/64/libCLSerCOM.so \lib/64/libFormatConversion.so \lib/64/libGCBase_gcc447_v3_0.so \lib/64/libGenCP_gcc447_v3_0.so \lib/64/libLog_gcc447_v3_0.so \lib/64/libMVGigEVisionSDK.so \lib/64/libMVGigEVisionSDK.so.4.1.2.2 \lib/64/libMVRender.so \lib/64/libMediaProcess.so \lib/64/libMvCamLVision.so \lib/64/libMvCamLVision.so.4.1.0.3 \lib/64/libMvCameraControl.so \lib/64/libMvCameraControl.so.4.1.2.2 \lib/64/libMvCameraControlWrapper.so \lib/64/libMvCameraControlWrapper.so.1.0.1.0 \lib/64/libMvUsb3vTL.so \lib/64/libMvUsb3vTL.so.4.1.2.2 \lib/64/libavutil.so \lib/64/liblog4cpp_gcc447_v3_0.so \lib/64/libswscale.so \lib/64/libusb-1.0.so.0unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lswscaleINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvUsb3vTLINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMVRenderINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMVGigEVisionSDKINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvCamLVisionINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvCameraControlWrapperINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvCameraControlINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMediaProcessINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lLog_gcc447_v3_0INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -llog4cpp_gcc447_v3_0INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lGenCP_gcc447_v3_0INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lGCBase_gcc447_v3_0INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lFormatConversionINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lCLSerCOMINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lCLProtocol_gcc447_v3_0INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lCLAllSerial_gcc447_v3_0INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lavutilINCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64