简体   繁体   中英

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 make command in the terminal, I have this kind of error:

fatal error:
'QTKit/QTKit.h' file not found
#import
1 error generated.
make[2]: ***
[modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_qtkit.mm.o] 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 https://raw.githubusercontent.com/Homebrew/install/master/install)" 
brew install homebrew/science/opencv3

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM