Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCv in Java: DescriptorExtractor is deprecated. What do I use instead?

I have some sample code which uses OpenCV (Java wrapper) to stitch 2 images together. It refers to a class "DescriptorExtractor" which is deprecated. I can't find any information in the official web documentation or the source-code about what I should use instead. I always get annoyed when something is deprecated and it doesn't tell you what you should use instead.

Can anyone help me?

I'm using OpenCV 3.4.1 with pre-built Windows libraries.

The official documentation for the class seems to be here.

The "FeatureDetector" class is likewise deprecated, likewise without any hint about what to use instead.

like image 353
Tim Cooper Avatar asked Mar 19 '18 07:03

Tim Cooper


1 Answers

I agree that Deprecated annotation in Java should have come with a required parameter which would provide information about the successor of the deprecated element, if any.

In OpenCV version 3.4.5 (and maybe earlier) in C++ docs DescriptorExtractor is defined as a type alias for Feature2D (see here):

typedef Feature2D DescriptorExtractor

so I believe you should switch to org.opencv.features2d.Feature2D class in your Java code updating its usages as appropriate.

With OpenCV wrappers (including ones for Java and Python) and corresponding auto-generated documentation, it is usually hard to infer any usage information - it is a good idea to consult with C++ sources and documentation, which appears to be hand-written.

like image 193
scrutari Avatar answered Nov 03 '22 00:11

scrutari