简体   繁体   English

在Linux Mint上的Qt Creator 3.5.1上使用OpenCV 3.3.1(最新内核)

[英]Using OpenCV 3.3.1 on Qt Creator 3.5.1 on Linux Mint (latest kernel)

I'm trying too make a project in C++ using OpenCV via Qt Creator. 我也试图通过Qt Creator使用OpenCV在C ++中创建项目。 I have not written any code yet as such, I'm just trying to get my project to access my openCV file. 我还没有写任何代码,我只是想让我的项目访问我的openCV文件。 I've tried a couple of methods I found on google, namely editing the $PKG_CONFIG_PATH variable: 我尝试了几种在google上找到的方法,即编辑$ PKG_CONFIG_PATH变量:

 echo $PKG_CONFIG_PATH
:/home/jess/Documents/SRI/TER/opencv-3.3.1`

(/home/jess... is where the openCV files are - as obtained and extracted from the website) my .pro file looks like this: (/ home / jess ...是openCV文件所在的位置-从网站获取并提取的)我的.pro文件如下所示:

QT       += core gui
# add open CV
CONFIG += link_pkgconfig
PKGCONFIG += opencv-3.3.1

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = test
TEMPLATE = app

SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

And when I build the project it tells me that openCV cannot be found (I have also tested using the name "openCV-3.3.1", same result) if anyone can give me any pointers as to where I'm going wrong, I would be most grateful! 当我构建项目时,它告诉我找不到openCV(我也使用名称“ openCV-3.3.1”进行了测试,结果相同),如果有人可以向我提供有关我要去哪里的任何指示,我将不胜感激!

You need to have OpenCV dev version installed on your system. 您需要在系统上安装OpenCV dev版本。 Fortunately OpenCV can be found in official Ubuntu/Mint repositories. 幸运的是,OpenCV可以在官方的Ubuntu / Mint存储库中找到。 To start developing OpenCV apps you need to install its -dev version. 要开始开发OpenCV应用,您需要安装其-dev版本。

sudo apt install libopencv-dev

Ok. 好。 Now head to your project's .pro file and link your project to OpenCV. 现在转到项目的.pro文件, 并将您的项目链接到OpenCV。

LIBS += -lopencv_core -lopencv_highgui

Make sure you've added all the OpenCV modules you need. 确保已添加所需的所有OpenCV模块。 OpenCV have the following modules: OpenCV具有以下模块:

  • core - a compact module defining basic data structures, including the dense multi-dimensional array Mat and basic functions used by all other modules. 核心 -定义基本数据结构的紧凑模块,包括密集的多维数组Mat和所有其他模块使用的基本功能。

  • imgproc - an image processing module that includes linear and non-linear image filtering, geometrical image transformations (resize, affine and perspective warping, generic table-based remapping), color space conversion, histograms, and so on. imgproc-图像处理模块,包括线性和非线性图像过滤,几何图像转换(调整大小,仿射和透视变形,基于通用表的重新映射),色彩空间转换,直方图等。

  • video - a video analysis module that includes motion estimation, background subtraction, and object tracking algorithms. 视频 -视频分析模块,包括运动估计,背景减法和对象跟踪算法。

  • calib3d - basic multiple-view geometry algorithms, single and stereo camera calibration, object pose estimation, stereo correspondence algorithms, and elements of 3D reconstruction. calib3d-基本的多视图几何算法,单镜头和立体相机校准,对象姿态估计,立体对应算法以及3D重构元素。

  • features2d - salient feature detectors, descriptors, and descriptor matchers. features2d-显着特征检测器,描述符和描述符匹配器。

  • objdetect - detection of objects and instances of the predefined classes (for example, faces, eyes, mugs, people, cars, and so on). objdetect-检测对象和预定义类的实例(例如,面孔,眼睛,杯子,人,汽车等)。

  • highgui - an easy-to-use interface to simple UI capabilities. highgui-简单的UI功能的易于使用的界面。

  • videoio - an easy-to-use interface to video capturing and video codecs. videoio-用于视频捕获和视频编解码器的易于使用的界面。

  • gpu - GPU-accelerated algorithms from different OpenCV modules. gpu-来自不同OpenCV模块的GPU加速算法。

  • ... some other helper modules, such as FLANN and Google test wrappers, Python bindings, and others. ...其他一些辅助模块,例如FLANN和Google测试包装器,Python绑定等。

To link your project to another module just add a -lopencv_<module> to LIBS . 要将项目链接到另一个模块,只需在LIBS添加-lopencv_<module>即可。 That's it! 而已!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM