Ask Your Question

Revision history [back]

Unable to run OpenCV on iOS device (works fine in simulator)

Hi all, I recently got into OpenCV for a personal project, and I am now trying to embed what I achieved into an iOS application. I was really happy that I got it to work since these were my very first lines of C++, but can't manage to get it to work outside of simulator. I'm using SURF and a Flann Matcher. The error I get is

libc++abi.dylib: terminating with uncaught exception of type cvflann::anyimpl::bad_any_cast

once I reach this line

#import <opencv2/imgproc/imgproc.hpp>
#import <opencv2/imgcodecs/ios.h>
#import <opencv2/xfeatures2d/nonfree.hpp>

std::vector<cv::Mat> baseDescriptors;
cv::Mat unitDescriptor;

// setup stuff
matcher.knnMatch(baseDescriptors[j], unitDescriptor, matches, 2); // <- here is the problem

I've looked at these [1, 2, 3, 4] with no luck. Already stripped down my imports and tried building configuration to Release but still nothing. I find this really weird, since the app runs fine in the simulator at this point I think I'm missing something related to build configuration. Thanks for any kind of help!

Unable to run OpenCV on iOS device (works fine in simulator)

Hi all, I recently got into OpenCV for a personal project, and I am now trying to embed what I achieved into an iOS application. I was really happy that I got it to work since these were my very first lines of C++, but can't manage to get it to work outside of simulator. I'm using SURF and a Flann Matcher. The error I get is

libc++abi.dylib: terminating with uncaught exception of type cvflann::anyimpl::bad_any_cast

once I reach this line

#import <opencv2/imgproc/imgproc.hpp>
#import <opencv2/imgcodecs/ios.h>
#import <opencv2/xfeatures2d/nonfree.hpp>

std::vector<cv::Mat> baseDescriptors;
cv::Mat unitDescriptor;

// setup stuff
FlannBasedMatcher matcher;
std::vector<std::vector<DMatch>> matches;
matcher.knnMatch(baseDescriptors[j], unitDescriptor, matches, 2); // <- here is the problem

I've looked at these [1, 2, 3, 4] with no luck. Already stripped down my imports and tried building configuration to Release but still nothing. I find this really weird, since the app runs fine in the simulator at this point I think I'm missing something related to build configuration. Thanks for any kind of help! help!