Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

feature detector crash

asked 2012-07-16 10:56:56 -0500

frondeur gravatar image

updated 2012-07-16 11:01:42 -0500


feature detector fails when used in simple program in visual studio 2010. I am using opencv 2.4.2 and also checked on 2.4.1. Only thing that is being done is to create a feature detector and use that to detect keypoints in an image. I get unhandled exception crash pointing to a function named "detecImpl()" inside detectors.cpp (i.e. features2d\detectors.cpp line:65). This error is really stuck and has taken enormous amount of time so any help is really appreciated.

#include <iostream>
#include <opencv2/core/core.hpp>
#include "opencv2/highgui/highgui.hpp"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/features2d/features2d.hpp>

using namespace std;
using namespace cv;

int main(int argc, char* argv[])
cv::Ptr<cv::FeatureDetector> featureDetector;
    cv::Ptr<cv::DescriptorExtractor> descriptorExtractor;
    featureDetector = cv::FeatureDetector::create("SURF");
    descriptorExtractor = cv::DescriptorExtractor::create("SURF");
cv::Mat imageColor;
cv::Mat image = cv::imread("car1.jpg", 0);
    cv::cvtColor(image, imageColor, CV_GRAY2BGR);
        imshow("Test Image",imageColor);
    catch(cv::Exception exc)
        cout << "CV error occured : " + exc.msg;
std::vector<cv::KeyPoint> currentKeypoints;

            featureDetector->detect(image,currentKeypoints);   //This line generates the error but no exception is caught ....
    catch(cv::Exception exc)
        cout << "CV error occured : " + exc.msg;
        return -1;
edit retag flag offensive close merge delete


Thanks, actually i didn't know when they moved it into separate lib. So when i figured it out the problem was solved.

frondeur gravatar imagefrondeur ( 2012-07-24 05:23:04 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2012-07-16 16:13:40 -0500

Maria Dimashova gravatar image

updated 2012-07-16 16:22:04 -0500

Hi! In 2.4 beta SURF and SIFT were moved to nonfree module to indicate possible legal issues of using those algorithms in user applications. So "opencv2/nonfree/nonfree.hpp" has to be included now. They were also inherited from cv::Algorithm, so cv::initModule_nonfree() has to be called before using them to avoid the problem with SURF, SIFT algorithms registration. See how it's done eg. in descriptor_extractor_matcher.cpp sample.

edit flag offensive delete link more

answered 2013-05-14 03:58:42 -0500


I have also added the include opencv2/nonfree/nonfree.hpp and cv::initModule_nonfree() but I still threw the same exception :(. So, please anyone help me. I have spent a lot of time on this bug.

edit flag offensive delete link more


yours is not an answer, but a question. please don't pirate old threads, instead start your own question, else noone can find it and respond..

berak gravatar imageberak ( 2013-05-14 04:40:26 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2012-07-16 10:56:56 -0500

Seen: 4,642 times

Last updated: May 14 '13