这个问题必须重复多次,但它不起作用,有时仍然没有答案.信息来源主要是这些
http://www.laganiere.name/opencvCookbook/chap1s1_2.shtml
http://www.youtube.com/watch?v=dgcXYQijV6c
This question must be duplicate many times, but it just doesn't work and sometimes it still remains unanswered. Sources of information are mainly these
http://www.laganiere.name/opencvCookbook/chap1s1_2.shtml
http://www.youtube.com/watch?v=dgcXYQijV6c
这是我认为应该/可以做的总结.(现在它对我有用.)希望我从一开始就提到了所有内容,目的是编写一个非常清晰的教程.
This is the summation of what I think one should/can do. (And now it works for me.) Hopefully I mentioned everything from the very beginning, the aim is to write a very clear tutorial.
为 QtCreator 安装 OpenCV
现在我在 QtCreator 中创建了一个新的控制台应用程序.
Now I have created a new console app in QtCreator.
//cvHello.pro
QT += core
QT -= gui
TARGET = cvHello
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
INCLUDEPATH += C:/Programs/opencv24/opencv_bin2/install/include
LIBS += "C:/Programs/opencv24/opencv_bin2/bin/*.dll"
SOURCES += main.cpp
OTHER_FILES +=
img.JPG
和主文件:
//main.cpp
#include <iostream>
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv/cv.h"
using namespace std;
int main()
{
cout << "Hello World!" << endl;
cv::Mat mat;
mat = cv::imread("img.JPG");
cvNamedWindow("hello");
cv::imshow("hello",mat);
cvWaitKey(0);
return 0;
}
我终于开始开心了.在调整这个问题时,我不得不尝试各种方法,如何定义LIBS.手动列出它们有帮助,起初我写错了.
Finally I am starting to be happy. When adjusting this question I had to try all ways, how to define LIBS. Listing them manually helped, at first I wrote them somehow wrongly.
最后是这样的:
LIBS += -LC:\Programs\opencv24\opencv_bin2\bin
libopencv_core240d
libopencv_highgui240d
libopencv_imgproc240d
libopencv_features2d240d
libopencv_calib3d240d
顺便说一句,如果我犯了任何语法错误,我很抱歉我的英语.:)
Btw if I've made any grammar mistakes, I am sorry for my english. :)
这篇关于如何在 QtCreator 中链接 opencv 并使用 Qt 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在 C++ 中读取和操作 CSV 文件数据?How can I read and manipulate CSV file data in C++?(如何在 C++ 中读取和操作 CSV 文件数据?)
在 C++ 中,为什么我不能像这样编写 for() 循环:In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,为什么我不能像这样编写 for() 循环: for(
OpenMP 如何处理嵌套循环?How does OpenMP handle nested loops?(OpenMP 如何处理嵌套循环?)
在循环 C++ 中重用线程Reusing thread in loop c++(在循环 C++ 中重用线程)
需要精确的线程睡眠.最大 1ms 误差Precise thread sleep needed. Max 1ms error(需要精确的线程睡眠.最大 1ms 误差)
是否需要“do {...} while ()"?环形?Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?环形?)