After many frustrating attempts I finally made OpenCv works on my mac.
Here I’ll explain how:
1) Install CMake (http://www.cmake.org/cmake/resources/software.html ) by just flowing the installer assistant
2)Download OpenCv (http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.3.1/)
3)Execute the followings instruction in your Terminal (/Applications/Utilities/Terminal)
cd /path to your download folder
tar xvf OpenCV-your version.tar.bz2
cd OpenCV-your version
cmake -G "Unix Makefiles" ..
sudo make install
4) Now under /usr/local/lib you should have some new files beginning with OpenCV
5) Now create a new XCode project
6) Now your project is create you can add the library we just download under “Build Phases”
6) Link the binaries by cliking “+” then “Add Other…” . A window pop-up, then strike “/” for me it was “shift-7” (in Switzerland) and type /usr/local/lib . The select opencv core & highgui which are the two most important library to have.
7) Now you should have the to library on the left bar, you can put the files into a seperate folder to make your project cleaner if you want.
8) Finally under “Build Settings” search for the “Search Paths” section and modify the entries as shown below.
42) The last step is to learn OpenCv.
Here is a template I always start with this make the include much easier.
using namespace cv;
using namespace std;
int main( int argc, char** argv )
capture = cvCreateCameraCapture(CV_CAP_ANY);
cvNamedWindow( "First Code", 1 );
while( key != 'q' )
img= cvQueryFrame( capture );
cvShowImage( "First Code", img);
key = cvWaitKey( 10 );
cvReleaseCapture( &capture );
cvDestroyWindow( "First code" );
It just return the input of your webcam 🙂
Good Luck. And catch you next time.