Problems in Installing openCV on Mac

I have installed the openCV3 successfully yesterday. And I find there are lots of problems even wrong ways in the website. So I decide to write this article to tell others who ready to install openCV after me so that you can use the simple and right way.

Before I tell the details, there is a video which is easy to understand the the whole process on YouTube.

In this article, I will tell you the steps of installing openCV and the details of these steps.Then, I will show you some common problems and their solutions.

Installing steps

  • Download openCV
  • Unzip into the openCV directory
  • Build the release directory and compile the openCV library with Cmake
  • Install

    Before download, you should make sure that your Mac has installed Xcode, Cmake, homebrew already.

    If you do not have these environments, I suggest you go to configure these environments first.

Download Xcode

Open App Store, search and download.

Download Cmake

Download

Download openCV

Download

And now, you have already installed the Xcode, Cmake and openCV.zip.

Unzip into the openCV directory and open the Terminal into the openCV directory, and then key these codes in terminal.

1
2
3
4
mkdir release
cd release
cmake -G "Unix Makefiles" ..
make

If you successfully build openCV with no error, then go ahead.

1
make install

Installation manual:

  • /usr/local/lib
  • /usr/local/include
  • /usr/local/share/

Until now, you have successfully installed openCV.

Start openCV with Xcode

  1. Create the OSX’s Command Line project, and add the openCV head file.

  1. Add the DLL into the project.

  1. After that, you can use openCV in Xcode project.

The Problems

And here are the problems I met.

Using homebrew to install openCV

There are lots of writers suggest use homebrew to install openCV. And at first, I used this way also. But I found a serious peoblem.

The problem is when the homebrew showed that I have finish installing, but I could’t find the source file, even I used the “which opencv”, it’s nothing.

Then I googled this problem, and the StackOverFlow tells me to use the “–HEAD”, but it’s useless.

So finally, I gave up this way.

About QTKit/QTKit.h

When I build openCV source files, the terminal shows this error:

1
2
3
4
5
6
7
8
XXX/cap_qtkit.mm:46:9: fatal error:
'QTKit/QTKit.h' file not found
#import 
^
1 error generated.
make[2]: *** [modulesideoio/CMakeFiles/opencv_videoio.dir/src/cap_qtkit.mm.o] Error 1
make[1]: *** [modulesideoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make: *** [all] Error 2

So, I googled this and found the reason of it is the Mac’s system.

The OSX 10.12 has the QTKit.framework, but the macOS Sierra takes it into AVFoundation.

And almost all the ways to solve it are very complex and difficult.

But in the latest version of openCV has solved it. So if you have met this problem, the fastest way to solve it is downloading the latest version.

About ippicv_macosx_20151201.tgz

There are a lot of people facing this problem.

The course is stopping at “ICV: Downloading ippicv_macosx_20151201.tgz…” or “ICV: Downloading ippicv_macosx_20141027.tgz…”

There exists an easy way to solve it. Just download another file and replace the original file.

20151201

20141027

And that’s all.