qt creator创建opencv工程
Posted navysummer
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了qt creator创建opencv工程相关的知识,希望对你有一定的参考价值。
1.创建新工程
附源码
CMakeLists.txt文件
cmake_minimum_required(VERSION 3.9.5) project(tests) set(CMAKE_CXX_STANDARD 14) set(OpenCV_DIR "/home/navy/Desktop/workspace/build") find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} "main.cpp") set(OpenCV_LIBS opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs) target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
main.cpp文件
#include<opencv2/opencv.hpp> #include <iostream> #include <math.h> using namespace cv; int main(){ Mat src = imread("/home/navy/Desktop/workspace/opencv_extra/testdata/gpu/caltech/image_00000009_0.png",0); if(src.empty()){ printf("load fail "); } namedWindow("test"); imshow("test",src); waitKey(0); return 0; }
以上是关于qt creator创建opencv工程的主要内容,如果未能解决你的问题,请参考以下文章
OpenCV 2.4.10 + Qt Creator 3.2.0 & Qt5.4.0 MingW 64bits Windows 7 - “退出代码 -1073741515”
Qt Creator中的OpenCV:无法连接创建者通信套接字/tmp/qt_temp.T32147/stub-socket:没有这样的文件或目录