久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 QtCreator 中鏈接 opencv 并使用 Qt 庫(kù)

How to link opencv in QtCreator and use Qt library(如何在 QtCreator 中鏈接 opencv 并使用 Qt 庫(kù))
本文介紹了如何在 QtCreator 中鏈接 opencv 并使用 Qt 庫(kù)的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

這個(gè)問(wèn)題必須重復(fù)多次,但它不起作用,有時(shí)仍然沒(méi)有答案.信息來(lái)源主要是這些
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

這是我認(rèn)為應(yīng)該/可以做的總結(jié).(現(xiàn)在它對(duì)我有用.)希望我從一開(kāi)始就提到了所有內(nèi)容,目的是編寫一個(gè)非常清晰的教程.

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

  1. 我已經(jīng)安裝了 MS Visual Studio 2010 Professional.(我作為學(xué)生有免費(fèi)許可證)-我認(rèn)為這沒(méi)有必要,只是提一下
  2. 下載:適用于 Windows 32 位的 Qt 5.0.1(MinGW 4.7,823 MB)
    2.1 安裝: 警告,Qt 使用的所有內(nèi)容(例如 OpenCV)必須位于名稱中不包含空格的目錄中.- 即程序文件"是錯(cuò)誤的.(但我不希望不同的程序文件直接堆積在 C 上,所以我只創(chuàng)建了一個(gè)文件夾Programs",其中安裝了所有重要的東西)
  3. 下載: cmake-2.8.10.2-win32-x86.exe - 為所有用戶安裝(這可以在程序文件中)
  4. 下載: OpenCV-2.4.0.exe,解壓到:C:Programsopencv24 - 它將創(chuàng)建一個(gè)目錄opencv";添加另一個(gè)文件夾opencv_bin".現(xiàn)在看起來(lái)像這樣:
    C:Programsopencv24opencv*
    C:Programsopencv24opencv_bin
  5. 設(shè)置 PATH 環(huán)境變量,以便有一個(gè)到 MinGW 編譯器的鏈接.例如C:ProgramsQtQt5.0.1ToolsMinGWin;
  6. 啟動(dòng) cmake-gui.exe
    6.1 源碼:設(shè)置OpenCV的默認(rèn)目錄;C:Programsopencv24opencv
    6.2 binaries:設(shè)置opencv_bin目錄;C:Programscopencv24opencv_bin
    6.3 點(diǎn)擊配置:
    • 選擇MinGW MakefilesSpecify native compilers,點(diǎn)擊下一步
    • 字段 C 用于 gcc.exe;C:/Programs/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe
    • Field C++ 用于 g++.exe;C:/Programs/Qt/Qt5.0.1/Tools/MinGW/bin/g++.exe
    • 字段fortran可以為空,點(diǎn)擊完成
  1. I have already MS Visual Studio 2010 Professional installed. (I have a free licence as a student) - I think this is not necessary, just a mention
  2. Download: Qt 5.0.1 for Windows 32-bit (MinGW 4.7, 823 MB)
    2.1 Install: Warning, everything that Qt uses (e.g. OpenCV) must be in directories that don't contain white-spaces in their names. - i.e. "Program Files" is wrong. (But I don't want different program files to accumulate directly on C, so I've only made a folder "Programs" in which everything important is installed)
  3. Download: cmake-2.8.10.2-win32-x86.exe - Install for all users (this can be in Program Files)
  4. Download: OpenCV-2.4.0.exe, extract to: C:Programsopencv24 - it'll create a dir "opencv"; add another folder "opencv_bin". Now it looks like this:
    C:Programsopencv24opencv*
    C:Programsopencv24opencv_bin
  5. Set PATH environment variable, so that there be a link to MinGW compiler. e.g. C:ProgramsQtQt5.0.1ToolsMinGWin;
  6. Start cmake-gui.exe
    6.1 source code: set the default dir for OpenCV; C:Programsopencv24opencv
    6.2 binaries: set the opencv_bin dir; C:Programscopencv24opencv_bin
    6.3 click configure:
    • Choose MinGW Makefiles and Specify native compilers, click next
    • Field C is for gcc.exe; C:/Programs/Qt/Qt5.0.1/Tools/MinGW/bin/gcc.exe
    • Field C++ is for g++.exe; C:/Programs/Qt/Qt5.0.1/Tools/MinGW/bin/g++.exe
    • Field fortran can be empty, click finish
  • WITH_QT - 必須被選中.
  • WITH_TBB、WITH_IPP、WITH_CUDA - 必須取消選擇
  • CMAKE_BUILD_TYPE - 單擊并輸入文本調(diào)試"(不帶引號(hào)).
  • 清除搜索字段中的文本.
  • WITH_QT - must be selected.
  • WITH_TBB, WITH_IPP, WITH_CUDA - must be unselected
  • CMAKE_BUILD_TYPE - click and enter a text "Debug" (without quotes).
  • Clear the text from the Search field.

現(xiàn)在我在 QtCreator 中創(chuàng)建了一個(gè)新的控制臺(tái)應(yīng)用程序.

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;
}

推薦答案

我終于開(kāi)始開(kāi)心了.在調(diào)整這個(gè)問(wèn)題時(shí),我不得不嘗試各種方法,如何定義LIBS.手動(dòng)列出它們有幫助,起初我寫錯(cuò)了.

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 

順便說(shuō)一句,如果我犯了任何語(yǔ)法錯(cuò)誤,我很抱歉我的英語(yǔ).:)

Btw if I've made any grammar mistakes, I am sorry for my english. :)

這篇關(guān)于如何在 QtCreator 中鏈接 opencv 并使用 Qt 庫(kù)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 亚洲交性 | 色婷婷精品久久二区二区蜜臂av | 成人日b视频 | 九九九视频在线观看 | 午夜爽爽男女免费观看hd | 亚洲一区视频在线 | 国产欧美在线视频 | 黑人巨大精品欧美一区二区免费 | 色爱综合| 中日韩欧美一级片 | 国产精品毛片久久久久久 | 亚洲天天干 | 国产精品性做久久久久久 | 超碰在线97国产 | www.久久久久久久久久久久 | 亚洲精品一区二区二区 | 日韩一区二区三区四区五区六区 | 久久成人精品视频 | 精品欧美色视频网站在线观看 | 成人伊人 | 中文在线一区二区 | 一区二区三区在线观看视频 | 美女爽到呻吟久久久久 | 亚洲国产精品成人 | 免费在线观看av网址 | 国产亚洲精品综合一区 | 污视频在线免费观看 | 国产精品久久久久久久久久久久冷 | 国产精品久久久亚洲 | 国产特级毛片aaaaaa | 亚洲精品国产第一综合99久久 | 在线国产小视频 | 国产a区 | 久操伊人 | 国产成人精品久久二区二区91 | 99精品网 | 在线观看视频91 | 欧洲性生活视频 | 国产精品亚洲第一区在线暖暖韩国 | 欧美在线一区二区三区 | 男女免费视频网站 |