0

I'm on a mac 10.7.5 trying to work with the OpenCV library in XCode 4.6.2. I'm following this tutorial http://sadeepj.blogspot.co.uk/2012/03/installing-and-configuring-opencv-to.html

So I've downloaded cmake and OpenCV2.3.1 I have written in terminal :

tar xvf OpenCV-2.3.1a.tar.bz2 
cd OpenCV-2.3.1 
mkdir build 
cd build 
cmake -G "Unix Makefiles" ..

It all works except at the Unix Makefiles command, where it says CMake Error: Could not create named generator Unix Makefiles..

Anyone know why this is happening or maybe there is another method of getting OpenCV running smoothly in Xcode?

Andrea F
  • 733
  • 2
  • 9
  • 16

1 Answers1

5

I encourage you to avoid compiling OpenCV by yourself, whenever possible.

You can download the latest OpenCV compiled framework for iOS here, and here you can find some previous versions. To use the framework, just drag the opencv2.framework directory to your XCode project, and you're done.

StatusReport
  • 3,397
  • 1
  • 23
  • 31
  • Thanks so much! I've written #include "cv.h" but is this no longer used in opencv2? – Andrea F Jul 15 '13 at 13:49
  • No problem :) You need to `#import ` instead (and I recommend to use the C++ interface instead the old C one). Since the headers are pretty big, I recommend to put the `#import` in the pch file surrounded by `#ifdef __cplusplus ... #endif`. – StatusReport Jul 15 '13 at 14:17
  • One more question sorry. I'm getting an error about missing architecture in my framework "missing required architecture x86_64 in file ..." and about 14 errors like this: _cvShowImage", referenced from: _main in File.o. I've changed my compiler aswell to GCC – Andrea F Jul 15 '13 at 15:17
  • 1
    You cannot use highgui functions (such as `cvShowImage`) with iOS. Actually, IIRC all the image loading should be done via `UIImage` or `CGImage`, and then to OpenCV's `cv::Mat`. To display an image, you need to convert your `cv::Mat` to `UIImage`. [Here](http://stackoverflow.com/questions/10254141/how-to-convert-from-cvmat-to-uiimage-in-objective-c) is a conversion example. – StatusReport Jul 15 '13 at 15:26