Problem with Stitching on iOS 6
Hello folks!
I'm trying to get a small app going that stitches images together using OpenCV on iOS. I've started by including the pre-built OpenCV 2 framework in my iOS project and setting up appropriate references. However, when I try and initiate a stitch operation, I get these linker errors:
Undefined symbols for architecture i386:
"cv::_InputArray::~_InputArray()", referenced from:
-[ViewController viewDidLoad] in ViewController.o
"cv::_OutputArray::~_OutputArray()", referenced from:
-[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here's what my view controller code looks like:
- (void)viewDidLoad
{
[super viewDidLoad];
UIImage* leftImage = [UIImage imageNamed:@"ridge-left.jpg"];
UIImage* rightImage = [UIImage imageNamed:@"ridge-right.jpg"];
UIImageView* testImageView = [[UIImageView alloc] initWithImage:leftImage];
[self.view addSubview:testImageView];
vector<Mat> images;
Mat leftMat = [leftImage toCVMat];
Mat rightMat = [rightImage toCVMat];
Mat panoramic;
images.push_back(leftMat); images.push_back(rightMat);
Stitcher stitcher = Stitcher::createDefault(false);
// stitcher.setWarper(new CylindricalWarper());
Stitcher::Status st = stitcher.stitch(images, panoramic);
}
I'm pretty new to OpenCV so I'm not sure if I'm using the APIs incorrectly or if there's something else at play. I should note that commenting out the call to stitcher.stitch() removes the linker error, so it has something to do with that method. I noticed that the destructors its complaining about have these macro settings (in core.hpp). Not sure what those mean, but could they be a factor?
#ifdef OPENCV_CAN_BREAK_BINARY_COMPATIBILITY
virtual ~_InputArray();
#endif
#ifdef OPENCV_CAN_BREAK_BINARY_COMPATIBILITY
virtual ~_OutputArray();
#endif
Appreciate any and all the help!
Thanks, Ani
UPDATE: I'm still having trouble with this. I've tried changing the target to iOS device, but I still get the same error for armv7 architecture. Any ideas?
Ld /Users/aniv/Library/Developer/Xcode/DerivedData/HelloOpenCV-fgbktrcekkodywhgrueujeajztog/Build/Intermediates/HelloOpenCV.build/Debug-iphoneos/HelloOpenCV.build/Objects-normal/armv7/HelloOpenCV normal armv7
cd /Users/aniv/Dev/HelloOpenCV
setenv IPHONEOS_DEPLOYMENT_TARGET 6.0
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk -L/Users/aniv/Library/Developer/Xcode/DerivedData/HelloOpenCV-fgbktrcekkodywhgrueujeajztog/Build/Products/Debug-iphoneos -F/Users/aniv/Library/Developer/Xcode/DerivedData/HelloOpenCV-fgbktrcekkodywhgrueujeajztog/Build/Products/Debug-iphoneos -F/Users/aniv/Dev/HelloOpenCV/../opencv/ios -F/Users/aniv/Dev/HelloOpenCV/HelloOpenCV -filelist /Users/aniv/Library/Developer/Xcode/DerivedData/HelloOpenCV-fgbktrcekkodywhgrueujeajztog/Build/Intermediates/HelloOpenCV.build/Debug-iphoneos/HelloOpenCV.build/Objects-normal/armv7/HelloOpenCV.LinkFileList -dead_strip -fobjc-arc -fobjc-link-runtime -stdlib=libstdc++ -miphoneos-version-min=6.0 -framework opencv2 -framework AVFoundation -framework ImageIO -lz -framework CoreMedia -framework CoreVideo -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/aniv/Library/Developer/Xcode/DerivedData/HelloOpenCV-fgbktrcekkodywhgrueujeajztog/Build/Intermediates/HelloOpenCV.build/Debug-iphoneos/HelloOpenCV.build/Objects-normal/armv7/HelloOpenCV
Undefined symbols for architecture armv7:
"cv::_OutputArray::~_OutputArray()", referenced from:
-[ViewController viewDidLoad] in ViewController.o
"cv::_InputArray::~_InputArray()", referenced from:
-[ViewController viewDidLoad] in ViewController.o
ld: symbol(s) not ...
Are you compiling for emulator? If not, something is broken with your project settings, because it tries to make a binary for x86:
ld: symbol(s) not found for architecture i386
Yes, I'm trying to get it to work for the iOS simulator.