diff --git a/modules/features2d/misc/java/filelist b/modules/features2d/misc/java/filelist index 0430b5423a..6c1b8ad8fd 100644 --- a/modules/features2d/misc/java/filelist +++ b/modules/features2d/misc/java/filelist @@ -1,2 +1 @@ -misc/java/src/cpp/features2d_manual.hpp include/opencv2/features2d.hpp diff --git a/modules/features2d/misc/java/gen_dict.json b/modules/features2d/misc/java/gen_dict.json index 5ed56c88ee..299749ac85 100644 --- a/modules/features2d/misc/java/gen_dict.json +++ b/modules/features2d/misc/java/gen_dict.json @@ -2,12 +2,6 @@ "class_ignore_list" : [ "SimpleBlobDetector" ], - "const_private_list" : [ - "OPPONENTEXTRACTOR", - "GRIDDETECTOR", - "PYRAMIDDETECTOR", - "DYNAMICDETECTOR" - ], "type_dict" : { "Feature2D": { "j_type": "Feature2D", diff --git a/modules/features2d/misc/java/src/cpp/features2d_manual.hpp b/modules/features2d/misc/java/src/cpp/features2d_manual.hpp deleted file mode 100644 index d9fd3fbded..0000000000 --- a/modules/features2d/misc/java/src/cpp/features2d_manual.hpp +++ /dev/null @@ -1,320 +0,0 @@ -#ifndef __OPENCV_FEATURES_2D_MANUAL_HPP__ -#define __OPENCV_FEATURES_2D_MANUAL_HPP__ - -#include "opencv2/opencv_modules.hpp" - -#ifdef HAVE_OPENCV_FEATURES2D -#include "opencv2/features2d.hpp" -#include "features2d_converters.hpp" - -#undef SIMPLEBLOB // to solve conflict with wincrypt.h on windows - -namespace cv -{ - -/** - * @deprecated Please use direct instantiation of Feature2D classes - */ -class CV_EXPORTS_AS(FeatureDetector) javaFeatureDetector -{ -public: - CV_WRAP void detect( const Mat& image, CV_OUT std::vector& keypoints, const Mat& mask=Mat() ) const - { return wrapped->detect(image, keypoints, mask); } - - CV_WRAP void detect( const std::vector& images, CV_OUT std::vector >& keypoints, const std::vector& masks=std::vector() ) const - { return wrapped->detect(images, keypoints, masks); } - - CV_WRAP bool empty() const - { return wrapped->empty(); } - - enum - { - FAST = 1, - STAR = 2, - SIFT = 3, - SURF = 4, - ORB = 5, - MSER = 6, - GFTT = 7, - HARRIS = 8, - SIMPLEBLOB = 9, - DENSE = 10, - BRISK = 11, - AKAZE = 12, - - - GRIDDETECTOR = 1000, - - GRID_FAST = GRIDDETECTOR + FAST, - GRID_STAR = GRIDDETECTOR + STAR, - GRID_SIFT = GRIDDETECTOR + SIFT, - GRID_SURF = GRIDDETECTOR + SURF, - GRID_ORB = GRIDDETECTOR + ORB, - GRID_MSER = GRIDDETECTOR + MSER, - GRID_GFTT = GRIDDETECTOR + GFTT, - GRID_HARRIS = GRIDDETECTOR + HARRIS, - GRID_SIMPLEBLOB = GRIDDETECTOR + SIMPLEBLOB, - GRID_DENSE = GRIDDETECTOR + DENSE, - GRID_BRISK = GRIDDETECTOR + BRISK, - GRID_AKAZE = GRIDDETECTOR + AKAZE, - - - PYRAMIDDETECTOR = 2000, - - PYRAMID_FAST = PYRAMIDDETECTOR + FAST, - PYRAMID_STAR = PYRAMIDDETECTOR + STAR, - PYRAMID_SIFT = PYRAMIDDETECTOR + SIFT, - PYRAMID_SURF = PYRAMIDDETECTOR + SURF, - PYRAMID_ORB = PYRAMIDDETECTOR + ORB, - PYRAMID_MSER = PYRAMIDDETECTOR + MSER, - PYRAMID_GFTT = PYRAMIDDETECTOR + GFTT, - PYRAMID_HARRIS = PYRAMIDDETECTOR + HARRIS, - PYRAMID_SIMPLEBLOB = PYRAMIDDETECTOR + SIMPLEBLOB, - PYRAMID_DENSE = PYRAMIDDETECTOR + DENSE, - PYRAMID_BRISK = PYRAMIDDETECTOR + BRISK, - PYRAMID_AKAZE = PYRAMIDDETECTOR + AKAZE, - - DYNAMICDETECTOR = 3000, - - DYNAMIC_FAST = DYNAMICDETECTOR + FAST, - DYNAMIC_STAR = DYNAMICDETECTOR + STAR, - DYNAMIC_SIFT = DYNAMICDETECTOR + SIFT, - DYNAMIC_SURF = DYNAMICDETECTOR + SURF, - DYNAMIC_ORB = DYNAMICDETECTOR + ORB, - DYNAMIC_MSER = DYNAMICDETECTOR + MSER, - DYNAMIC_GFTT = DYNAMICDETECTOR + GFTT, - DYNAMIC_HARRIS = DYNAMICDETECTOR + HARRIS, - DYNAMIC_SIMPLEBLOB = DYNAMICDETECTOR + SIMPLEBLOB, - DYNAMIC_DENSE = DYNAMICDETECTOR + DENSE, - DYNAMIC_BRISK = DYNAMICDETECTOR + BRISK, - DYNAMIC_AKAZE = DYNAMICDETECTOR + AKAZE - }; - - /** - * supported: FAST STAR SIFT SURF ORB MSER GFTT HARRIS BRISK AKAZE Grid(XXXX) Pyramid(XXXX) Dynamic(XXXX) - * not supported: SimpleBlob, Dense - * @deprecated - */ - CV_WRAP static Ptr create( int detectorType ) - { - //String name; - if (detectorType > DYNAMICDETECTOR) - { - //name = "Dynamic"; - detectorType -= DYNAMICDETECTOR; - } - if (detectorType > PYRAMIDDETECTOR) - { - //name = "Pyramid"; - detectorType -= PYRAMIDDETECTOR; - } - if (detectorType > GRIDDETECTOR) - { - //name = "Grid"; - detectorType -= GRIDDETECTOR; - } - - Ptr fd; - switch(detectorType) - { - case FAST: - fd = FastFeatureDetector::create(); - break; - //case STAR: - // fd = xfeatures2d::StarDetector::create(); - // break; - //case SIFT: - // name = name + "SIFT"; - // break; - //case SURF: - // name = name + "SURF"; - // break; - case ORB: - fd = ORB::create(); - break; - case MSER: - fd = MSER::create(); - break; - case GFTT: - fd = GFTTDetector::create(); - break; - case HARRIS: - { - Ptr gftt = GFTTDetector::create(); - gftt->setHarrisDetector(true); - fd = gftt; - } - break; - case SIMPLEBLOB: - fd = SimpleBlobDetector::create(); - break; - //case DENSE: - // name = name + "Dense"; - // break; - case BRISK: - fd = BRISK::create(); - break; - case AKAZE: - fd = AKAZE::create(); - break; - default: - CV_Error( Error::StsBadArg, "Specified feature detector type is not supported." ); - break; - } - - return makePtr(fd); - } - - CV_WRAP void write( const String& fileName ) const - { - FileStorage fs(fileName, FileStorage::WRITE); - wrapped->write(fs); - } - - CV_WRAP void read( const String& fileName ) - { - FileStorage fs(fileName, FileStorage::READ); - wrapped->read(fs.root()); - } - - javaFeatureDetector(Ptr _wrapped) : wrapped(_wrapped) - {} - -private: - - Ptr wrapped; -}; - -/** - * @deprecated - */ -class CV_EXPORTS_AS(DescriptorExtractor) javaDescriptorExtractor -{ -public: - CV_WRAP void compute( const Mat& image, CV_IN_OUT std::vector& keypoints, Mat& descriptors ) const - { return wrapped->compute(image, keypoints, descriptors); } - - CV_WRAP void compute( const std::vector& images, CV_IN_OUT std::vector >& keypoints, CV_OUT std::vector& descriptors ) const - { return wrapped->compute(images, keypoints, descriptors); } - - CV_WRAP int descriptorSize() const - { return wrapped->descriptorSize(); } - - CV_WRAP int descriptorType() const - { return wrapped->descriptorType(); } - - CV_WRAP bool empty() const - { return wrapped->empty(); } - - enum - { - SIFT = 1, - SURF = 2, - ORB = 3, - BRIEF = 4, - BRISK = 5, - FREAK = 6, - AKAZE = 7, - - - OPPONENTEXTRACTOR = 1000, - - - - OPPONENT_SIFT = OPPONENTEXTRACTOR + SIFT, - OPPONENT_SURF = OPPONENTEXTRACTOR + SURF, - OPPONENT_ORB = OPPONENTEXTRACTOR + ORB, - OPPONENT_BRIEF = OPPONENTEXTRACTOR + BRIEF, - OPPONENT_BRISK = OPPONENTEXTRACTOR + BRISK, - OPPONENT_FREAK = OPPONENTEXTRACTOR + FREAK, - OPPONENT_AKAZE = OPPONENTEXTRACTOR + AKAZE - }; - - //supported SIFT, SURF, ORB, BRIEF, BRISK, FREAK, AKAZE, Opponent(XXXX) - //not supported: Calonder - CV_WRAP static Ptr create( int extractorType ) - { - //String name; - - if (extractorType > OPPONENTEXTRACTOR) - { - //name = "Opponent"; - extractorType -= OPPONENTEXTRACTOR; - } - - Ptr de; - switch(extractorType) - { - //case SIFT: - // name = name + "SIFT"; - // break; - //case SURF: - // name = name + "SURF"; - // break; - case ORB: - de = ORB::create(); - break; - //case BRIEF: - // name = name + "BRIEF"; - // break; - case BRISK: - de = BRISK::create(); - break; - //case FREAK: - // name = name + "FREAK"; - // break; - case AKAZE: - de = AKAZE::create(); - break; - default: - CV_Error( Error::StsBadArg, "Specified descriptor extractor type is not supported." ); - break; - } - - return makePtr(de); - } - - CV_WRAP void write( const String& fileName ) const - { - FileStorage fs(fileName, FileStorage::WRITE); - wrapped->write(fs); - } - - CV_WRAP void read( const String& fileName ) - { - FileStorage fs(fileName, FileStorage::READ); - wrapped->read(fs.root()); - } - - javaDescriptorExtractor(Ptr _wrapped) : wrapped(_wrapped) - {} - -private: - - Ptr wrapped; -}; - -#if 0 -//DO NOT REMOVE! The block is required for sources parser -enum -{ - DRAW_OVER_OUTIMG = 1, // Output image matrix will not be created (Mat::create). - // Matches will be drawn on existing content of output image. - NOT_DRAW_SINGLE_POINTS = 2, // Single keypoints will not be drawn. - DRAW_RICH_KEYPOINTS = 4 // For each keypoint the circle around keypoint with keypoint size and - // orientation will be drawn. -}; - -CV_EXPORTS_AS(drawMatches2) void drawMatches( const Mat& img1, const std::vector& keypoints1, - const Mat& img2, const std::vector& keypoints2, - const std::vector >& matches1to2, Mat& outImg, - const Scalar& matchColor=Scalar::all(-1), const Scalar& singlePointColor=Scalar::all(-1), - const std::vector >& matchesMask=std::vector >(), int flags=0); - -#endif - -} //cv - -#endif // HAVE_OPENCV_FEATURES2D - -#endif // __OPENCV_FEATURES_2D_MANUAL_HPP__ diff --git a/modules/features2d/misc/java/test/BruteForceHammingDescriptorMatcherTest.java b/modules/features2d/misc/java/test/BruteForceHammingDescriptorMatcherTest.java index 6bcc3ea6c1..2bdcc589f9 100644 --- a/modules/features2d/misc/java/test/BruteForceHammingDescriptorMatcherTest.java +++ b/modules/features2d/misc/java/test/BruteForceHammingDescriptorMatcherTest.java @@ -12,7 +12,7 @@ import org.opencv.core.Point; import org.opencv.core.Scalar; import org.opencv.core.DMatch; import org.opencv.features2d.DescriptorMatcher; -import org.opencv.features2d.FeatureDetector; +import org.opencv.features2d.FastFeatureDetector; import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestRunner; import org.opencv.imgproc.Imgproc; @@ -46,7 +46,7 @@ public class BruteForceHammingDescriptorMatcherTest extends OpenCVTestCase { MatOfKeyPoint keypoints = new MatOfKeyPoint(); Mat descriptors = new Mat(); - FeatureDetector detector = FeatureDetector.create(FeatureDetector.FAST); + Feature2D detector = FastFeatureDetector.create(); Feature2D extractor = createClassInstance(XFEATURES2D+"BriefDescriptorExtractor", DEFAULT_FACTORY, null, null); detector.detect(img, keypoints); diff --git a/modules/features2d/misc/java/test/BruteForceHammingLUTDescriptorMatcherTest.java b/modules/features2d/misc/java/test/BruteForceHammingLUTDescriptorMatcherTest.java index 67ceb0b60f..60baa7c246 100644 --- a/modules/features2d/misc/java/test/BruteForceHammingLUTDescriptorMatcherTest.java +++ b/modules/features2d/misc/java/test/BruteForceHammingLUTDescriptorMatcherTest.java @@ -11,7 +11,7 @@ import org.opencv.core.Point; import org.opencv.core.Scalar; import org.opencv.core.DMatch; import org.opencv.features2d.DescriptorMatcher; -import org.opencv.features2d.FeatureDetector; +import org.opencv.features2d.FastFeatureDetector; import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestRunner; import org.opencv.imgproc.Imgproc; @@ -45,7 +45,7 @@ public class BruteForceHammingLUTDescriptorMatcherTest extends OpenCVTestCase { MatOfKeyPoint keypoints = new MatOfKeyPoint(); Mat descriptors = new Mat(); - FeatureDetector detector = FeatureDetector.create(FeatureDetector.FAST); + Feature2D detector = FastFeatureDetector.create(); Feature2D extractor = createClassInstance(XFEATURES2D+"BriefDescriptorExtractor", DEFAULT_FACTORY, null, null); detector.detect(img, keypoints); diff --git a/modules/features2d/misc/java/test/FASTFeatureDetectorTest.java b/modules/features2d/misc/java/test/FASTFeatureDetectorTest.java index 091f4a7b50..044e70d0ed 100644 --- a/modules/features2d/misc/java/test/FASTFeatureDetectorTest.java +++ b/modules/features2d/misc/java/test/FASTFeatureDetectorTest.java @@ -8,7 +8,8 @@ import org.opencv.core.Mat; import org.opencv.core.MatOfKeyPoint; import org.opencv.core.Point; import org.opencv.core.Scalar; -import org.opencv.features2d.FeatureDetector; +import org.opencv.features2d.Feature2D; +import org.opencv.features2d.FastFeatureDetector; import org.opencv.core.KeyPoint; import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestRunner; @@ -16,7 +17,7 @@ import org.opencv.imgproc.Imgproc; public class FASTFeatureDetectorTest extends OpenCVTestCase { - FeatureDetector detector; + Feature2D detector; KeyPoint[] truth; private Mat getMaskImg() { @@ -35,7 +36,7 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase { @Override protected void setUp() throws Exception { super.setUp(); - detector = FeatureDetector.create(FeatureDetector.FAST); + detector = FastFeatureDetector.create(); truth = new KeyPoint[] { new KeyPoint(32, 27, 7, -1, 254, 0, -1), new KeyPoint(27, 32, 7, -1, 254, 0, -1), new KeyPoint(73, 68, 7, -1, 254, 0, -1), new KeyPoint(68, 73, 7, -1, 254, 0, -1) }; } diff --git a/modules/features2d/misc/java/test/ORBDescriptorExtractorTest.java b/modules/features2d/misc/java/test/ORBDescriptorExtractorTest.java index 1009e1bfd5..dd7ee3e899 100644 --- a/modules/features2d/misc/java/test/ORBDescriptorExtractorTest.java +++ b/modules/features2d/misc/java/test/ORBDescriptorExtractorTest.java @@ -6,7 +6,6 @@ import org.opencv.core.Mat; import org.opencv.core.MatOfKeyPoint; import org.opencv.core.Point; import org.opencv.core.Scalar; -import org.opencv.features2d.DescriptorExtractor; import org.opencv.core.KeyPoint; import org.opencv.features2d.ORB; import org.opencv.test.OpenCVTestCase;