OpenCV安装步骤,手把手教你解决一切问题

本文介绍了OpenCV,一个开源的计算机视觉库,涵盖算法、安装教程、Qt配合使用以及跨平台部署。重点讲解了3.4.x版本的下载、安装步骤,以及CMake构建过程,适合开发者进行实时视觉项目开发。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

0.1.关于OpenCV

OpenCV(Open Source Computer Vision Library)是一个开源的机器视觉和机器学习软件库。OpenCV为计算机视觉提供框架,产品受BSD授权。OpenCV库含有超过2500种优化的算法,其中包括全面经典的和当今世界最先进的机器视觉学习算法,可以用来检测和识别人脸,识别对象、人类行动的视频分类,跟踪相机移动,跟踪物体移动,提取对象的3D模型,从立体相机产生3D点云图像缝合到一起还原一个高分辨率场景,还可以删除红眼、跟随眼球运动、识别景物,提供增强现实(AR)等。

除了谷歌、雅虎、微软、英特尔、IBM、索尼、本田、丰田等老牌公司使用OpenCV库之外,还有许多初创公司,如Applied Minds、VideoSurf和Zeitera,都广泛使用OpenCV。OpenCV的部署使用跨度范围从缝合街景图片一起,入侵检测在以色列,监控录像监控我的设备在中国,帮助机器人导航和接在“柳树车库”对象,检测游泳池溺水事故在欧洲,运行互动艺术在西班牙和纽约,检查跑道的碎片在土耳其,检查标签产品在世界各地的工厂在日本快速人脸检测。

它具有C++、Python、Java和MATLAB接口,并支持Windows、Linux、Android和Mac OS。OpenCV主要倾向于实时视觉应用,并在可用时利用MMX和SSE指令。一个全功能的CUDA和OpenCL接口正在积极开发中。有超过500种算法,而组成或支持这些算法的函数数量是它的10倍。OpenCV是用C++原生编写的,它有一个模板化的接口,可以与STL容器无缝地工作。

0.2.安装OpenCV

进入https://opencv.org/releases/

这里建议下载3.4.x版本,此文档将基于3.4.1来讲解。

 

下载完成后,双击运行exe,选择输出目录(如”D:\OpenCV“)

 

 

如果官网下载过慢,建议百度搜索“OpenCV3.4.1下载“,选择国内站点,注意防毒。

0.3.安装Qt

各类网站都有提供Qt的下载地址,官网的下载方式较为繁琐(需注册、实名认证等),可以百度搜索“Qt下载”,建议使用国内清华大学开源软件镜像站。

https://mirrors.tuna.tsinghua.edu.cn/qt/archive/qt/5.9/5.9.0/

 

Qt版本建议使用5.x.x系列。

0.4.构建OpenCV

解压完了OpenCV,还需要构建OpenCV,才能在开发平台上使用这些库文件。我们建议使用CMake来构建,因为CMake是一个开源并跨平台的应用程序,可用于配置和构建开源项目。

https://cmake.org/download/

平台(Platform)选择Windows Source

 

如果下载速度较慢,仍可以百度搜索“CMake下载“,选择国内站点,注意防毒和系统兼容性。

 

 

 

 

如果出现CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.请尝试以下步骤:

 

 

由于文件大小超过csdn限制的60M,所以分割成2个文件了,请注意下载。 Delphi-OpenCV (master) OpenCV version - 2.4.8 Development environment - Delphi XE2-XE5 Contributors: Laentir Valetov email: laex@bk.ru Mikhail Grigorev email: sleuthhound@gmail.com How to install: 1.Download the archive Delphi-OpenCV-master.zip 2.Unzip it to a convenient directory, thus get the following directory structure <Directory, such as 'C:\OpenCV\' - <PROJECT_ROOT>> <bin> <component> <include> <opencv_classes> <samples> 3.Add the search path for the modules of the project in Delphi IDE (Tools-Options-Delphi Options-Library-Library path) <PROJECT_ROOT>\Include <PROJECT_ROOT>\Include\core <PROJECT_ROOT>\Include\highgui <PROJECT_ROOT>\Include\imgproc <PROJECT_ROOT>\Include\legacy <PROJECT_ROOT>\Include\nonfree <PROJECT_ROOT>\Include\objdetect <PROJECT_ROOT>\Include\calib3d <PROJECT_ROOT>\Include\contrib <PROJECT_ROOT>\Include\video <PROJECT_ROOT>\Include\ml <PROJECT_ROOT>\Include\stitching <PROJECT_ROOT>\component where <PROJECT_ROOT> directory, which was unzipped project. Additionally, you can specify the path to the library header files FFMPEG <PROJECT_ROOT>\Include\ffmpeg <PROJECT_ROOT>\Include\ffmpeg\ctypes <PROJECT_ROOT>\Include\ffmpeg\libavcodec <PROJECT_ROOT>\Include\ffmpeg\libavfilter <PROJECT_ROOT>\Include\ffmpeg\libavformat <PROJECT_ROOT>\Include\ffmpeg\libavutil <PROJECT_ROOT>\Include\ffmpeg\libswscale Examples of using FFMPEG library header files are in the <PROJECT_ROOT>\Delphi-OpenCV-master\Include\ffmpeg\examples 4.Open in Delphi IDE and compile: Examples of the use of certain functions and procedures <PROJECT_ROOT>\samples\LibDemo.groupproj Examples of the use of video processing algorithms <PROJECT_ROOT>\samples\MultiDemo.groupproj Examples of the use of video processing algorithms using VCL.Forms <PROJECT_ROOT>\samples\VCLDemo.groupproj Examples of use of components. To install the components, open and install <PROJECT_ROOT>\Include\component\OpenCV.dpk <PROJECT_ROOT>\samples\ComponentDemo.groupproj
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值