我是靠谱客的博主 纯情信封,最近开发中收集的这篇文章主要介绍机器视觉1,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

以下无需要参考==>直接跳过到官方文件篇

资源(64位)下载地址

资源下载地址
opencv4.6https://opencv.org/releases/
cmakehttps://cmake.org/download/
ffmpeglibshttps://download.csdn.net/download/mengtianwxs/86858524

cmake 做对应关系


在这里插入图片描述


环境变量
在这里插入图片描述
勾选with_opengl with_qt configure

configure问题汇总 遇到问题了参考下列文章解析
@1 https://www.cnblogs.com/iriczhao/p/11372688.html
@2 https://blog.csdn.net/xiangfengl/article/details/120700756

错误二 [modulescoreCMakeFilesopencv_core.dirbuild.make:1708: bin/libopencv_core450.dll] Error 1
设置OPENCV_VS_VERSIONINFO_SKIP=1,也就是打勾,若无法找到变量OPENCV_VS_VERSIONINFO_SKIP,则可以自己添加一个:

@3 https://blog.csdn.net/weixin_43763292/article/details/112975207
@4 https://blog.csdn.net/zzyzxb/article/details/124950479
@5 https://blog.csdn.net/weixin_38871681/article/details/110916080
@6 https://blog.csdn.net/KayChanGEEK/article/details/79919417
@7 https://blog.csdn.net/qq_41740162/article/details/121127848

二、opencv_videoio_ffmpeg_64.dll、opencv_videoio_ffmpeg.dll下载失败
进入opencv3.4.2sources3rdpartyffmpeg目录
将 ffmpeg.cmake 的https://raw.githubusercontent.com
修改为:https://raw.staticdn.net

@8 https://blog.csdn.net/weixin_44727100/article/details/122250425
@9 https://blog.csdn.net/qq_36351159/article/details/108226698

flags.make文件 CXX添加 -O3 -fPIC

@10 https://blog.csdn.net/qq_40594137/article/details/126104187

未完结…


官方文件篇

经过一周时间的折腾查找资料再次三次,直到n次实践后,发现了官方提供的配置过程,强烈推荐下列方式
编译环境

Windows 10 64,
Qt 5.9.7
OpenCV 3.2.0

https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows

Check the box [X]WITH_QT
Check the box [X]WITH_OPENGL
set Qt5_DIR to D:Qt5.9mingw53_32libcmakeQt5
Uncheck the box []ENABLE_PRECOMPILED_HEADERS
Then click configure again.
Set QT_MAKE_EXECUTABLE to D:Qt5.9mingw53_32binqmake.exe
Set Qt5Concurrent_DIR to D:Qt5.9mingw53_32libcmakeQt5Concurrent
Set Qt5Core_DIR to D:Qt5.9mingw53_32libcmakeQt5Core
Set Qt5Gui_DIR to D:Qt5.9mingw53_32libcmakeQt5Gui
Set Qt5Test_DIR to D:Qt5.9mingw53_32libcmakeQt5Test
Set Qt5Widgets_DIR to D:Qt5.9mingw53_32libcmakeQt5Widgets
Set Qt5OpenGL_DIR to D:Qt5.9mingw53_32libcmakeQt5OpenGL
Set CMAKE_BUILD_TYPE to Release or RelWithDebInfo
Set OPENCV_VS_VERSIONINFO_SKIP=1
try this: in cmake check the box ENABLE_CXX11

cmake configure的过程提示ffmpeg下载失败,有效的解决方案参考如下文章:
https://zhuanlan.zhihu.com/p/488401407

https://ghproxy.com/

wget & curl
wget https://ghproxy.com/https://github.com/stilleshan/ServerStatus/archive/master.zip
wget https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile
curl -O https://ghproxy.com/https://github.com/stilleshan/ServerStatus/archive/master.zip
curl -O https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile


修改 opencvsources3rdpartyffmpeg下ffmpeg.cmake下载网址参考如上格式。
https://ghproxy.com/https://raw.githubusercontent.com/opencv/opencv_3rdparty/${FFMPEG_BINARIES_COMMIT}/ffmpeg/)

pro文件引用路径按自己的填写

INCLUDEPATH +=D:OpenCVopencvbuildinclude
LIBS += D:OpenCVmingw_buildbinlibopencv_core320.dll
LIBS += D:OpenCVmingw_buildbinlibopencv_highgui320.dll
LIBS += D:OpenCVmingw_buildbinlibopencv_imgcodecs320.dll
LIBS += D:OpenCVmingw_buildbinlibopencv_imgproc320.dll
LIBS += D:OpenCVmingw_buildbinlibopencv_features2d320.dll
LIBS += D:OpenCVmingw_buildbinlibopencv_calib3d320.dll

测试程序如下

cv::Mat image=cv::imread(“D://workspace//testopencv//a.jpg”,1);
cv::namedWindow(“My image”);
cv::imshow(“My img”,image);

运行效果:
在这里插入图片描述

最后

以上就是纯情信封为你收集整理的机器视觉1的全部内容,希望文章能够帮你解决机器视觉1所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(48)

评论列表共有 0 条评论

立即
投稿
返回
顶部