I was having exactly the same issue reported by mjepson and tvdev. It seems there's a small configuration problem with Qt 4.7.4 (my QtCreator's about window says it's 4.7.4, but the version I installed was 4.8.1, though!) and gcc on the new Mac OS X 10.8 Mountain Lion. OpenCV is a BSD-licensed library for digital image processing which implements several hundred computer vision algorithms. Unfortunately compiling it on the Mac was not straightforward—requiring Fink or MacPorts—and the one existing Mac framework was out of date and no longer maintained. Hello everybody. I would appreciate if someone can help me with this. I have installed Opencv with python on a windows PC. No problem, I am trying to do the same on a mac. (snow leopard) However, I did the following: -Installed python 2.7 ( i know mac comes with python but i got recommended that i had to reinstall it) -Installed Numpy So if I do something like 'import numpy as np' in python. Installing OpenCV for MAC! After instructions guide for installing OpenCV on Ubuntu and installing OpenCV for Windows, here is the guide to install OpenCV on Mac. I have been using OpenCV on ubuntu 14.10 for three years now. However, installing OpenCV on Mac was real pain. No appropriate tutorials added to the pain.!!
From NUI Group Community Wiki
Jump to: navigation, search
This page is a duplicate of 'Installing OpenCV on MacOS X'. It contains a subset of the same information. Please attempt to merge information. If unnecessary, redirect or delete. |
Prebuilt Version
there is a prebuilt version of OpenCV framwork for OSX ( info here: http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port )
you can download it directly from: http://www.ient.rwth-aachen.de/~asbach/OpenCV-Private-Framework-1.1.dmg
then mount the dmg and in Terminal
et voila'! you have the framework installed.
Compiling yourself
Note! I tried these instructions with no luck, I then found this post and used macports (same as Darwinports I think) to install OpenCV directly.
Introduction and a Warning
OpenCV is very nice application that is required to run David Wallin's Touchlib multitouch libraries in Mac OS X. I am writing this walkthrough for people wanting to install OpenCV on their Mac.
Before we get started, I would like to inform you that I am pretty much a newbie when it comes to programming, the command line, and the like. Therefore, if these instructions damage your computer in any way, I take absolutely no responsibility. Proceed at your own risk.
Anyway, now that I have gotten that out of the way, let's begin.
Installing Xcode
The first thing I would do is install Xcode if you haven't already. You can find Xcode on your OS X reinstallation disk. I'm not sure if it is necessary, but there are some OpenCV dependencies that are included on that disc - mainly gcc4.0 and X11. You can find these in the /Xcode Tools/Packages/ directory of the OS X disc. Installing them is fairly straightforward, just double click on gcc4.0.pkg and it will launch an installer. Do the same for X11SDK.pkg. I believe that if you are trying to compile OpenCV on an Intel Mac, you will also have to install MacOSX10.4u.pkg.
Installing Python
Mac OSX 10.5 (and maybe Tiger) already comes with Python. If you still need it, the easiest way to install Python would be to download the installer from here. Just run the installer and that should take care of everything.
Installing External Dependencies
There are several more external dependencies, mainly libraries, that you need to install. I used Fink to install them. It comes with an installer for Fink, so you won't have to compile anything. MacPorts is also a viable option to get these dependencies. You can find the installer at MacPorts.org.
Fink Java vm for mac.
You could use the included FinkCommander app to install the necessary libraries, but I just used Terminal. To install a library in Fink through Terminal, open up a new shell and type in the following:
Replace 'libname' with the name of whatever library you are installing. I am not 100 percent sure of all the libraries you need, but these are the ones I installed:
pkgconfiglibjpeglibtifflibpng3pango1-xft2-devatk1gtk+2-devglib2-dev
Again, some of these you may not need, but I would go ahead and install all of them just in case.
MacPorts
If you are using MacPorts to install the dependencies, use the following command in terminal to install them. The names of the ports are slightly different in MacPorts compared to their respective name in Fink so don't worry. Again replace the 'libname' with the name of the dependency you wish to install. Press enter. Enter your password when prompted.
Dependency names:
zlib
pkgconfig
jpeg
libpng
tiff
gtk2 (Note: This will install other dependencies as well since it depends on quite a few others itself. Hence, the long waiting period)
To verify that all the necessary dependencies have been installed, run the following command in a terminal session and check the given list:
Downloading, Configuring, Compiling and Installing OpenCV
Now, we can finally get around to downloading the OpenCV source code. Copy the following command into a Terminal shell:
It will ask for a password. Just hit enter. Now, copy this in:
This will download the source code into a directory in your home folder. It is about 100MB and may take a while depending on your connection speed. Once this is done, navigate to the new directory in Terminal:
Now, we finally get to configure the source code. It would be wise to make a build folder by typing in the following:
If you used Fink to install the external libraries, run the configure script with this command if you are on a PPC Mac:
If you used MacPorts to install the dependencies, run the configure script with the following command. I used this on my Intel MBP and it seemed to work whereas I wasn't able to get the command after this one to work. If you are installing OpenCV on OSX 10.4, change both of the '5' 's to '4u'. If you plan on using mainly C/C++, omit the '--with-python' segment. - catchpatrick
If you are on an Intel Mac, type the command below. I have not tested this command myself so I have no idea if it works, though it was mentioned on the OpenCV wiki for OS X.
Now, after that is finished, it will tell you to run make. To save from typing in a command later on, copy this into Terminal:
After awhile, it will come back and you will probably notice that sudo make install has already been entered in for you. How convenient. Now, hit enter and type in your administrator password.
Now, it should come back with the last line reading something like this:
What you need to do for now is copy that command. Now, instead of pasting it into the prompt, type in:
It will ask you for your password. Just enter it in. Using the sudo command allows you to gain temporary access to all files on the system.
Now, paste in that snipet we copied a little earlier and hit enter. It may seem like nothing much has happened, but don't worry. Now run the following command to check that everything was installed okay. Pay attention because it will require some user input.
Testing OpenCV
https://jhimkg.weebly.com/blog/email-for-mac. Okay, let's test one of the sample apps. Copy baboon.jpg and morphology.c from the samples folder in Users/Username/opencv/samples/c/ into your home folder (Users/Username).
Open up Terminal, and type in:
For Bash:
For C-Shell:
Note: Add the 'Bash' command to the '.bashrc' file in your home directory if you use bash or the 'C-Shell' command to the '.cshrc' file if you use C-shell. This will prevent you from having to type in this command just to compile. Now close your current session and open a new one for these settings to take effect.
When I had trouble getting the sample to compile, I had to run the above command before it would work. So running this first should help it compile. Now, go to the samples directory (eg. /Users/<username>/opencv/samples/c or /opt/local/share/opencv/samples/c/) and run this command:
This will compile the sample app. We can now run it by typing in:
If it launches a window with a picture of a baboon and a slider at the top, you're in luck! It looks like you've successfuly installed OpenCV!
Opencv For Mac Os
This guide was pretty much a hash of several tutorials on installing OpenCV on the Mac. You may not even have to install everything I've mentioned here. I have not completely tested these instructions myself, but I believe this is all I have done to get OpenCV running on my system.
If you need help, I probably won't be able to help much, but go ahead and ask anyway. Check out the sites in the References section below if you are having trouble.
References
Mac OS X OpenCV Port - OpenCV Library Wiki - This is where I got most of the information in this walkthrough.
Christoph Seibert's OpenCV on Mac OS X - This really helped me figure out what external libraries I was missing.
Several posts from the OpenCV Yahoo! Group helped me figure out my biggest problems in getting OpenCV working.
Opencv For Mac
If there are any references I am missing, I apologize.
Opencv Download For Mac Os X
Thanks for reading this walkthrough and I hope it helped!
- Kyle
Install Opencv Mac Os
Retrieved from 'http://wiki.nuigroup.com/Installing_OpenCV_on_Mac_OS_X'