OpenCV3 and Qt on OSX configuration

asked 2016-11-26 07:22:27 -0500

Tiras gravatar image


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

Here is my env variables:
enter image description here

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/17...
https://www.learnopencv.com/install-o...
http://stackoverflow.com/questions/31...

edit retag flag offensive close merge delete