andresouris andresouris - 6 months ago 60
C++ Question

Install openCV on xcode for c++

I have problems to install openCV on xcode in order to develop in C++.
I tried to follow this tutorial

But, I have a problem when I do the

command in the terminal, I have this kind of error:

fatal error:

'QTKit/QTKit.h' file not found


1 error generated.

make[2]: ***

[modules/highgui/CMakeFiles/opencv_highgui.dir/src/] Error 1

Do you have any solution?


Try to install OpenCV through homebrew. To do this, open terminal and run the following commands.

/usr/bin/ruby -e "$(curl -fsSL" 
brew install homebrew/science/opencv3

Last command will install OpenCV3 and all dependencies in /usr/local/Cellar/opencv3/

Then you can link .dylib and .h/.hpp files to your XCode project and use OpenCV.

If you have any questions, I'm happy to answer them.

[EDIT]: If you use macOS 10.12 or later, install OpenCV with following commands.

brew install opencv3 --with-ffmpeg --with-tbb --with-contrib
brew reinstall opencv3 --HEAD --with-python3 --with-ffmpeg --with-tbb --with-contrib