opencv 3, blobdetection, The function/feature is not implemented () in detectAndCompute
Asked Answered
J

4

13

I have a problem with opencv 3: I want to use a feature detector, SimpleBlobDetector, about to use filters by convexity and circularity. But when I try to execute the code, the following error is tracked:

The function/feature is not implemented () in detectAndCompute

Then the application crashes.

I searched for informations in the internet without any relevant answer. I think the 3rd version of Opencv could be responsible for this bug, because I know I use the detector the good way (I tried exactly like the official opencv tutorial) and I noticed than the SimpleBlobDector has been modified for the third version.

Using breakpoint, I know that the following line crashes:

detector.detect(gray, keypoints);

The SimpleBlobDetector has been created (using the create function) and configured, the gray image isn't empty and the keypoints vector does not need to be filled before the detection.

I use opencv 3.0.0, compiled in MinGW with QtCreator. The opencv treatment is not launched from the main thread.

Did anybody else have the same problem? I would be gratefull if I could have a patch or another solution using another class. I really need to use convexity to filter my blobs and the other detectors I found (FeatureDetector or Brisk) cannot be configurable and only return keypoints, which doesn't have the area or fullness parameters to calculate convexity.

Thanks in advance

Julius answered 3/6, 2015 at 13:58 Comment(1)
Do you can share some code? How big is your image? For me it works in OpenCV 3.0.0 - Which version do you have build? Github or Beta?Parrett
T
21

this looks like it is solved, but maybe it helps someone else. I had the same problem. I created blob detector like this:

cv::SimpleBlobDetector detector;
detector.create(params);
detector.detect( img, keypoints );

This ended up with error: The function/feature is not implemented () in detectAndCompute.

But when I tried it like this:

cv::Ptr<cv::SimpleBlobDetector> detector = cv::SimpleBlobDetector::create(params); 
detector->detect( img, keypoints );

Now everything works as expected.

It is really strange and if anyone knows why is working like that let me know please.

Timbre answered 12/8, 2015 at 10:44 Comment(0)
E
16

This is because you're using OpenCV 3.X, where (as of this writing) all of the examples you'll find online use OpenCV 2.X.

If you dig around, though, you'll find the transition guide: http://docs.opencv.org/master/db/dfa/tutorial_transition_guide.html#tutorial_transition_hints_headers

Which says you need to use:

Ptr<SomeAlgo> algo = makePtr<SomeAlgo>(...);
Ptr<SomeAlgo> algo = SomeAlgo::create(...);

Instead of:

SomeAlgo algo(); // bad

So in this case, you'll need to use:

Ptr<SimpleBlobDetector> d = SimpleBlobDetector::create();

Or:

Ptr<SimpleBlobDetector> d = SimpleBlobDetector::create(params);

If you've got params.

Elwina answered 8/12, 2015 at 7:12 Comment(1)
you need to use Ptr<SimpleBlobDetector> , a raw pointer will "kill itself" immediatelyTwylatwyman
J
2

Thanks for the response.

I use detect (like I said in my previous message). I think the detect function probably uses detectAndCompute.

The lack of descriptor can be the problem indeed, because I already had an equivalent problem with Emgu (the C# version of opencv) until I found a developer note saying that the method wasn't corrected yet and the descriptor was the cause.

For others who have the same problem, I finally used cv::findContours instead of the blob detector. It works much better, without any problem. To replace the convexity detection, you can evaluate it using the fullness (shape area / bounding box area). To replace the circularity, use the following formula:

circle area / bounding box area = PI/4

I hope this will hope other people.

Julius answered 4/6, 2015 at 9:4 Comment(0)
P
0

Just use detect(...) and not detectAndCompute(...). There is no feature descriptor defined for blob detection.

See here: https://mcmap.net/q/741762/-how-to-use-opencv-simpleblobdetector

Parrett answered 3/6, 2015 at 14:29 Comment(1)
This isn't the case — as OP states, the crash is on the detector.detect(…) line.Elwina

© 2022 - 2024 — McMap. All rights reserved.