Ask Your Question
1

detectAndCompute in OpenCV3 "not implemented"?

asked 2014-10-22 14:21:05 -0600

Doombot gravatar image

updated 2020-11-09 11:33:41 -0600

Whether by using this:

cv::FeatureDetector * detector = new cv::BRISK();   
detector->detect(objectImg, objectKeypoints);
detector->detect(sceneImg, sceneKeypoints);
delete detector;

cv::DescriptorExtractor * extractor = new cv::BRISK();
extractor->compute(objectImg, objectKeypoints, objectDescriptors);
extractor->compute(sceneImg, sceneKeypoints, sceneDescriptors);
delete extractor;

or

BRISK somecoolstuff;
somecoolstuff.detect(objectImg,objectKeypoints);
somecoolstuff.detect(sceneImg,sceneKeypoints);

somecoolstuff.compute(objectImg,objectKeypoints,objectDescriptors);
somecoolstuff.compute(sceneImg,sceneKeypoints,sceneDescriptors);

I am getting the following console error when the following code (OpenCV3, x64, Visual Studio) tries to evaluate "detect":

" OpenCV Error: The function/feature is not implemented <> in cv::Feature2D::detectAndCompute, file C:\opencv3\Sources\modules#features2d\src\feature2d.cpp, line 144 "

What is strange is that I used the folder C:\opencv3... in the past but now I am using D:\OpenCV3... (I reorganized my drives). All my linkers-include-etc. are correctly set up for the new folder.

So, is detectAndCompute supposed to work in OCV3, or is there some n00b error in my code? Using breakpoints, I can say that the code before is working correctly (objectImg, etc. are initialized and loaded).

edit retag flag offensive close merge delete

Comments

[update:]

the public constructor for BRISK has been removed in the meantime, so the method mentioned in the answer below is the only way left now (for the better, imho).

berak gravatar imageberak ( 2014-10-24 08:29:44 -0600 )edit

Haha working with OpenCV 3 right now is very is somewhat frustrating (since a lot of previous tutorials no longer work) but it is a good opportunity for me to become a more experienced programmer. Thanks you all for helping people here get on track!

Doombot gravatar imageDoombot ( 2014-10-24 08:36:40 -0600 )edit

well, they're not afraid to break things, and they're always 5 steps ahead of you ;)

berak gravatar imageberak ( 2014-10-24 08:39:17 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
3

answered 2014-10-22 16:24:18 -0600

Hi! Yes, detectAndCompute supposed to work in OCV3 ;-) You just have to create algorithm like that:

cv::Ptr<cv::BRISK> ptrBrisk = cv::BRISK::create();
ptrBrisk->detect(imTmp, objectKeypoints);

Your error is very simple but probably shows a design problem in Opencv3. Indeed, your code seems logical and correct, but behind-the-scenes, BRISK::create() doesn't create a BRISK object but a BRISK_Impl object!

edit flag offensive delete link more

Comments

Wow OK I'll check it out!

Doombot gravatar imageDoombot ( 2014-10-22 17:09:58 -0600 )edit
1

answered 2020-11-08 03:59:41 -0600

Freeman gravatar image

Please note that the detector object detects and the descriptor object computes the descriptors:

// Define features detector
cv::Ptr<cv::FastFeatureDetector> detector = cv::FastFeatureDetector::create(10, true);
// Detect the keypoints
std::vector<cv::KeyPoint> keypoints1, keypoints2;
detector->detect(im1, keypoints1);
detector->detect(im2, keypoints2);
// Compute the keypoints descriptors
cv::Mat descriptors1, descriptors2;
cv::Ptr<cv::xfeatures2d::BriefDescriptorExtractor> brief = cv::xfeatures2d::BriefDescriptorExtractor::create(32);
brief->compute(im1, keypoints1, descriptors1);
brief->compute(im2, keypoints2, descriptors2);
edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-10-22 14:21:05 -0600

Seen: 13,837 times

Last updated: Nov 08 '20