Ask Your Question

Revision history [back]

OpenCV 3.1: cvflann::anyimpl::bad_any_cast

Hi there,

I have an iOS project running OpenCV 3.1. I have this bit of code that crashes ONLY in debug mode. If I run this exact same code but change Xcode to run the project in release mode, the crash does not occur and it works as expected.

vector< vector< cv::DMatch >> matches;
cv::FlannBasedMatcher matcher(new cv::flann::LshIndexParams(10, 10, 2));
matcher.knnMatch(descriptors, movingImage.descriptors, matches, 2);

The error that prints is: "libc++abi.dylib: terminating with uncaught exception of type cvflann::anyimpl::bad_any_cast"

My problem is very similar to these other issues mentioned here: http://answers.opencv.org/question/10358/how-to-match-orb-descriptors-with-flann-lsh/ http://answers.opencv.org/question/503/how-to-use-the-lshindexparams/

But neither of those solve my issue. Also, these issues were brought up almost 3 years ago and it seems like they should be fixed by now.

Any ideas?