不同工业相机的sdk不同,可以到相应的官网下载,我使用的是大华相机和海康相机
一、大华相机
下载SDK:
官方下载地址:http://download.huaraytech.com/pub/sdk/
推荐使用的是2.3.1的Linux的x86的版本
点击下载
安装:
将下载的压缩包用指令unzip 压缩,.run文件增加可执行权限,然后运行即可打开软件。
解压:unzip MVware
更改文件权限:chmod 777 MVware (这里是添加可执行权限)
使用root权限进行安装:sudo su
执行某个可执行程序,开始安装:sudo ./[name]
打开软件:找到软件的 .sh文件,从终端进入(运行run.sh)
安装默认位置:/opt/DahuaTech/MVviewer
去/opt/DahuaTech/MVviewer看看安装好了没有
如果出现错误:
Verifying archive integrity...Error in MD5 checksums: 16723259cefb95037e59fb4bd1e49329 is different from 65551710649beca71f37793c41c35a2f
有可能是下载的文件数据损失了, 需要重新到官网下载
测试:
打开大华的软件:
/opt/DahuaTech/MVviewer/bin/run.sh
成功打开MVviewer
在QT中使用大华相机
新建一个QT工程
导入OpenCV的头文件和库:
.pro文件中输入下列代码
INCLUDEPATH +=/usr/local/include/ \
/usr/local/include/opencv4/ \
/usr/local/include/opencv4/opencv2
LIBS +=/usr/local/lib/lib*
添加大华头文件和动态库:
刚才下载好的SDK在这个位置: 文件夹—其他位置—计算机 /opt/DahuaTech/MVviewer
将大华目录下的头文件 include 和动态库 lib 复制到qt工程文件夹下
将这两个文件导入QT工程中:
在.pro文件中配置大华的环境
输入下列代码
INCLUDEPATH +=./include \
LIBS += -L/opt/DahuaTech/MVviewer/lib/ -lMVSDK
LIBS += -L/opt/DahuaTech/MVviewer/lib/ -lImageConvert
LIBS += -L/opt/DahuaTech/MVviewer/lib/ -lVideoRender
LIBS += -L/opt/DahuaTech/MVviewer/lib/GenICam/bin/Linux64_x64/ -lGCBase_gcc421_v3_0 -lGenApi_gcc421_v3_0 -lLog_gcc421_v3_0
LIBS += -L/opt/DahuaTech/MVviewer/lib/GenICam/bin/Linux64_x64/ -llog4cpp_gcc421_v3_0 -lNodeMapData_gcc421_v3_0 -lXmlParser_gcc421_v3_0
LIBS += -L/opt/DahuaTech/MVviewer/lib/GenICam/bin/Linux64_x64/ -lMathParser_gcc421_v3_0
LIBS+=-L/opt/DahuaTech/MVviewer/lib -lMVSDK
添加测试代码
将我经常用的Camera和src的文件复制到工程文件夹下,并将其导入Qt工程中(用下面的代码测试)
这个工程有video.h, video.cpp 和 main这三个文件
插入大华相机,运行,显示设备信息即成功
完成
二、海康相机
下载SDK:
官方下载地址:海康机器人-机器视觉-下载中心 (hikrobotics.com)
安装命令:
sudo apt install ./MVS-2.1.2....deb
- 打开SDK测试:终端输入:“/opt/MVS/bin/MVS.sh”
注意!安装海康相机的驱动可能会导致点云切割的那个包编译报错: symbol lookup error: /lib/x86_64-linux-gnu/libpcl_io.so.1.12: undefined symbol: libusb_set_option
qt中测试海康相机
- 在qt中配置相机环境
- 在QT中新建项目,将MVS文件中的include文件复制到项目文件夹下
- pro文件:
在项目中添加库,选择外部库,然后选择库文件所在的路径下,选择opt/mvs/lib/64下的所有的 .so文件,一个一个添加
文章来源:https://www.toymoban.com/news/detail-600561.html
文章来源地址https://www.toymoban.com/news/detail-600561.html
得到以下结果:
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.0
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lswscale
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvUsb3vTL
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMVRender
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMVGigEVisionSDK
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvCamLVision
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvCameraControlWrapper
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMvCameraControl
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lMediaProcess
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lLog_gcc447_v3_0
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -llog4cpp_gcc447_v3_0
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lGenCP_gcc447_v3_0
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lGCBase_gcc447_v3_0
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lFormatConversion
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lCLSerCOM
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lCLProtocol_gcc447_v3_0
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lCLAllSerial_gcc447_v3_0
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
unix:!macx: LIBS += -L$$PWD/../../../../../opt/MVS/lib/64/ -lavutil
INCLUDEPATH += $$PWD/../../../../../opt/MVS/lib/64
DEPENDPATH += $$PWD/../../../../../opt/MVS/lib/64
到了这里,关于1.8安装大华相机SDK及测试的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!