I am trying to develope my toy project by using OpenCV
and Qt
Here is my setup file and simple source from internet.
I install OpenCV3
by brew install opencv3
myproject.pro:
TEMPLATE = app
CONFIG += console c++11 link_pkgconfig
CONFIG -= app_bundle
CONFIG -= qt
QT_CONFIG -= no-pkg-config
PKGCONFIG += opencv
SOURCES += main.cpp
LIBS += -L/usr/local/lib \
-lopencv_core \
-lopencv_imgproc \
-lopencv_features2d\
-lopencv_highgui
main.cpp:
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
using namespace std;
using namespace cv;
Mat src; Mat dst;
char window_name1[] = "Unprocessed Image";
char window_name2[] = "Processed Image";
int main( int argc, char** argv )
{
/// Load the source image
src = imread( argv[1], 1 );
namedWindow( window_name1, WINDOW_AUTOSIZE );
imshow("Unprocessed Image",src);
dst = src.clone();
GaussianBlur( src, dst, Size( 15, 15 ), 0, 0 );
namedWindow( window_name2, WINDOW_AUTOSIZE );
imshow("Processed Image",dst);
waitKey();
return 0;
}
FYI:
Either PKG_CONFIG_PATH: /usr/local/opt/opencv3/lib/pkgconfig
or
/usr/local/Cellar/opencv3/3.1.0_4/lib/pkgconfig
are not work
Problem:
18:21:52: Running steps for project aiyara...
18:21:52: Configuration unchanged, skipping qmake step.
18:21:52: Starting: "/usr/bin/make"
/Users/el/Qt/5.7/clang_64/bin/qmake -spec macx-clang CONFIG+=x86_64 CONFIG+=qml_debug CONFIG+=force_debug_info CONFIG+=separate_debug_info -o Makefile ../aiyara/aiyara.pro
Project ERROR: opencv2 development package not found
make: *** [Makefile] Error 3
18:21:52: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project aiyara (kit: Desktop Qt 5.7.0 clang 64bit)
When executing step "Make"
18:21:52: Elapsed time: 00:00.
References:
http://stackoverflow.com/questions/17518408/setting-up-opencv-in-qt-on-osx
https://www.learnopencv.com/install-opencv-3-on-yosemite-osx-10-10-x/
http://stackoverflow.com/questions/31253541/opencv-in-qt-creator-on-mac