I'm actualy trying to use OpenCV with ARKit to build an AR app.
For the past 6 hours I tried everything to install OpenCV on my Swift project but that seems impossible.
I followed this tutorial on Medium and I ended up with 3 new files with the framework : OpenCVWrapper.h and OpenCVWrapper.mm for the wrapper and LittleFarm-Bridging-Header.h for the bridging header, here is the code :
OpenCVWrapper.h
#import <Foundation/Foundation.h>
#import <stdio.h>
@interface OpenCVWrapper : NSObject
- (void) isItWorking;
@end
OpenCVWrapper.mm
#import "OpenCVWrapper.h"
#import <opencv2/opencv.hpp>
@implementation OpenCVWrapper
using namespace std;
- (void) isItWorking {
printf("Hey");
}
@end
LittleFarm-Bridging-Header.h
#import "OpenCVWrapper.h"
But then I get this error : 'opencv2/opencv.hpp' file not found
I tried to figure what was the problem and I set Framework_Search_Path to $(PROJECT_DIR).
That doesn't change anything and if I tried to comment the related line I get this error :
ld: framework not found opencv2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit : In Build Phase > Link Binary with Librairies the framework opencv2 is here.
Thanks in advance for the help !
I finaly managed to fix my problem with the great help of hoang Cap.
Notice that the version 3.2 generates some issues, 3.1.0.1 is working fine.
pod 'OpenCV', '~> 3.1.0.1'
Deactivate bitcode on both Pods target and your project.