I downloaded the OpenCV iOS framework from here and have it working fine with iOS 6, but on iOS 5.0, whenever I call:
self.videoCamera = [[CvVideoCamera alloc] initWithParentView:self.imageView];
from this tutorial, I get the following error message:
dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_nonatomic
Referenced from: /var/mobile/Applications/8ADDFB67-97CE-4F6B-94B5-BD2548E0E6DD/MyApp.app/MyApp
Expected in: /usr/lib/libobjc.A.dylib
dyld: Symbol not found: _objc_setProperty_nonatomic
Referenced from: /var/mobile/Applications/8ADDFB67-97CE-4F6B-94B5-BD2548E0E6DD/MyApp.app/MyApp
Expected in: /usr/lib/libobjc.A.dylib
Is the latest version only for iOS 6? Is there an equivalent for iOS 5?
See this Q&A:
http://answers.opencv.org/question/4767/build-opencv-for-ios-5/
It seems that there are issues with latest source, and they suggest that you use the most recent pre-built framework (2.4.3).
Having said that, I have a version I built from current source last week which is running fine on ios6.0, 5.1 and 5.0 (see github projects here and here)
But when I try the video example you pointed to with this framework, I get the same error.
So it seems like it depends on exactly which feature of openCV you are trying to use….
update
I have just tried 2.4.3 and get the same error. Going back one version, 2.4.2, doesn’t help because
<opencv2/highgui/cap_ios.h>is not present. This file declares theCvVideoCameraclass and delegate protocol, so without it you won’t get anywhere with this example. Interestingly,cap_ios.his an Objective-C class declaration, unlike the rest of openCV which is C++… so this particular feature might well only work with ios6update2
OK I managed to get it running with a recent build of openCV from the latest source.
1 / Copy these pre-build source files into your project:
opencv/modules/highgui/src/
2 / in the three .mm files change these lines:
to:
2 / In your viewController change
to
That’s about it… possibly one or two other tweaks but i think that’s all it took to get it running under a deployment target of 5.1.