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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks so much! I've written #include "cv.h" but is this no longer used in opencv2?
No problem :) You need to #import <opencv2/opencv.hpp> 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.
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
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 is a conversion example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.