From 61cddd8b6362d861a90f1b24c2bce4a871f4239d Mon Sep 17 00:00:00 2001 From: Vadim Pisarevsky Date: Thu, 16 Oct 2014 22:52:04 +0400 Subject: [PATCH] fixed opencv_java build --- modules/features2d/src/mser.cpp | 2 +- modules/features2d/test/test_keypoints.cpp | 3 - .../java/generator/src/cpp/features2d_manual.hpp | 88 +++++++++++----------- modules/java/generator/src/cpp/jni_part.cpp | 6 -- 4 files changed, 46 insertions(+), 53 deletions(-) diff --git a/modules/features2d/src/mser.cpp b/modules/features2d/src/mser.cpp index 44b23ac..d5058d9 100644 --- a/modules/features2d/src/mser.cpp +++ b/modules/features2d/src/mser.cpp @@ -673,7 +673,7 @@ static int preprocessMSER_8uC3( MSCRNode* node, int Ne, int edgeBlurSize ) { - int srccpt = src.step-src.cols*3; + int srccpt = (int)(src.step-src.cols*3); const uchar* srcptr = src.ptr(); const uchar* lastptr = srcptr+3; double* dxptr = dx.ptr(); diff --git a/modules/features2d/test/test_keypoints.cpp b/modules/features2d/test/test_keypoints.cpp index bdfd5e9..46fd395 100644 --- a/modules/features2d/test/test_keypoints.cpp +++ b/modules/features2d/test/test_keypoints.cpp @@ -75,9 +75,6 @@ protected: } vector keypoints; - vector > msers; - CvMat src = image; - detector->detect(image, keypoints); if(keypoints.empty()) diff --git a/modules/java/generator/src/cpp/features2d_manual.hpp b/modules/java/generator/src/cpp/features2d_manual.hpp index 90a1611..81668f3 100644 --- a/modules/java/generator/src/cpp/features2d_manual.hpp +++ b/modules/java/generator/src/cpp/features2d_manual.hpp @@ -90,67 +90,68 @@ public: //not supported: SimpleBlob, Dense CV_WRAP static javaFeatureDetector* create( int detectorType ) { - String name; + //String name; if (detectorType > DYNAMICDETECTOR) { - name = "Dynamic"; + //name = "Dynamic"; detectorType -= DYNAMICDETECTOR; } if (detectorType > PYRAMIDDETECTOR) { - name = "Pyramid"; + //name = "Pyramid"; detectorType -= PYRAMIDDETECTOR; } if (detectorType > GRIDDETECTOR) { - name = "Grid"; + //name = "Grid"; detectorType -= GRIDDETECTOR; } + Ptr fd; switch(detectorType) { case FAST: - name = name + "FAST"; - break; - case STAR: - name = name + "STAR"; - break; - case SIFT: - name = name + "SIFT"; - break; - case SURF: - name = name + "SURF"; + 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: - name = name + "ORB"; + fd = ORB::create(); break; case MSER: - name = name + "MSER"; + fd = MSER::create(); break; case GFTT: - name = name + "GFTT"; + fd = GFTTDetector::create(); break; case HARRIS: - name = name + "HARRIS"; + fd = GFTTDetector::create(); break; case SIMPLEBLOB: - name = name + "SimpleBlob"; - break; - case DENSE: - name = name + "Dense"; + fd = SimpleBlobDetector::create(); break; + //case DENSE: + // name = name + "Dense"; + // break; case BRISK: - name = name + "BRISK"; + fd = BRISK::create(); break; case AKAZE: - name = name + "AKAZE"; + fd = AKAZE::create(); break; default: CV_Error( Error::StsBadArg, "Specified feature detector type is not supported." ); break; } - return new javaFeatureDetector(FeatureDetector::create(name)); + return new javaFeatureDetector(fd); } CV_WRAP void write( const String& fileName ) const @@ -332,43 +333,44 @@ public: //not supported: Calonder CV_WRAP static javaDescriptorExtractor* create( int extractorType ) { - String name; + //String name; if (extractorType > OPPONENTEXTRACTOR) { - name = "Opponent"; + //name = "Opponent"; extractorType -= OPPONENTEXTRACTOR; } + Ptr de; switch(extractorType) { - case SIFT: - name = name + "SIFT"; - break; - case SURF: - name = name + "SURF"; - break; + //case SIFT: + // name = name + "SIFT"; + // break; + //case SURF: + // name = name + "SURF"; + // break; case ORB: - name = name + "ORB"; - break; - case BRIEF: - name = name + "BRIEF"; + de = ORB::create(); break; + //case BRIEF: + // name = name + "BRIEF"; + // break; case BRISK: - name = name + "BRISK"; - break; - case FREAK: - name = name + "FREAK"; + de = BRISK::create(); break; + //case FREAK: + // name = name + "FREAK"; + // break; case AKAZE: - name = name + "AKAZE"; + de = AKAZE::create(); break; default: CV_Error( Error::StsBadArg, "Specified descriptor extractor type is not supported." ); break; } - return new javaDescriptorExtractor(DescriptorExtractor::create(name)); + return new javaDescriptorExtractor(de); } CV_WRAP void write( const String& fileName ) const diff --git a/modules/java/generator/src/cpp/jni_part.cpp b/modules/java/generator/src/cpp/jni_part.cpp index c8475d0..e9776ce 100644 --- a/modules/java/generator/src/cpp/jni_part.cpp +++ b/modules/java/generator/src/cpp/jni_part.cpp @@ -24,15 +24,9 @@ JNI_OnLoad(JavaVM* vm, void* ) return -1; bool init = true; -#ifdef HAVE_OPENCV_FEATURES2D - init &= cv::initModule_features2d(); -#endif #ifdef HAVE_OPENCV_VIDEO init &= cv::initModule_video(); #endif -#ifdef HAVE_OPENCV_CONTRIB - init &= cv::initModule_contrib(); -#endif if(!init) return -1; -- 2.7.4