在QtCreator 整合OpenCV 和Qt
簡介
簡介建立OpenCV 二進位檔案
QtCreator 專案配置
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
#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 變數中手動列出必要的函式庫,而不是使用「*.dll」:LIBS += -LC:\Programs\opencv24\opencv_bin2\bin \ libopencv_core240d \ libopencv_highgui240d \ libopencv_imgproc240d \ libopencv_features2d240d \ libopencv_calib3d240d \
以上是如何在Qt Creator中成功整合OpenCV和Qt?的詳細內容。更多資訊請關注PHP中文網其他相關文章!