openCV 3 extra modules in android

asked 2015-09-17 09:13:18 -0500

lamthao gravatar image


currently I am using the openCV 3 sdk for android. I am using the native files and with jni files. it is working so far.

now the problem: I want to implement FLANN ( But I get an error. It says that it cannot find "opencv2/xfeatures2d.hpp". I found out that xfeatures2d is not included in the sdk (some other extra modules are also not included in the sdk). Those extra modules I found here and downloaded it. Now I can see the module xfeatures2d with all its source files (.cpp) and header files (.hpp). I know that the opencv_contrib is coming from the nonfree part of openCV and has legal issues and can not work with the openCV manager for android. But this is not important right now.

So, can I somehow include xfeatures2d in my project that the FLANN example will work?

If yes, how? Unfortunately I am not familiar with cmake and the cmake process. (Right now I just include the "" file from the sdk/native/jni folder within my file and it works. Can I modify the file to tell him to include the .cpp and .hpp files needed by xfeatures2d?)

Any help would be great! Thank you!

edit retag flag offensive close merge delete


  • the FlannBasedMatcher is available in android w/o contrib repo
  • SURF/SIFT were moved to the contrib repo in opencv3, but unfortunately, even if you add it to your (local) android install, you won't be able to use any of them (that's a bug, the whole wrap-feature2d-to-java concept needs a major revamp, imho)

  • try to use something like KAZE instead of SURF/SIFT

berak gravatar imageberak ( 2015-09-17 09:24:10 -0500 )edit

thanks for the quick answer and the useful information! i will try kaze then, am I correct to try this

lamthao gravatar imagelamthao ( 2015-09-17 09:55:25 -0500 )edit

let me try to clear this up further: BfMatcher with HAMMING should be used for the binary(CV_8U) descriptors, like BRIEF,BRISK,ORB, the FlannBasedMatcher for float descriptors.

again, unfortunately, we do not have so many of those in the free section ...

berak gravatar imageberak ( 2015-09-17 10:04:10 -0500 )edit

I just started with openCV a few days ago and I am not used to the vocabulary so far. But I can explain my task and maybe somebody can tell me what can be done and what cannot be done. So, I have to develope an android app which reads a picture from the galery, takes the picture, do some operations with openCV and show the result. To do that, it should use native OpenCV 3 files. As I mentioned I used the native files from openCV 3 sdk from android.

What works already is painting the picture grey an show that (a very simple operation).

What should work (this is taken from my paper, I do not know if this makes sense) : - Detectors & Descriptors: BRIEF, Dense; FAST, GoodFeaturesToTrack, MSER, ORB, SIFT, STAR, SURF, FREAK and BRISK - Feature Point Algorithms: FLANN, BruteForce

Any ideas?

lamthao gravatar imagelamthao ( 2015-09-17 11:23:01 -0500 )edit

does that make any sense? right now, I tried to detect feature points with AKAZE and match them with FLANN (FlannBaseMatcher). This did not work with the error "Unsupported format or combination of formats". Which algorithms can I combine for FLANN and BruteForce?

lamthao gravatar imagelamthao ( 2015-09-17 11:28:02 -0500 )edit

AKAZE is another binary one, so BFMatcher(and HAMMING).

imho, we need a little table here, what works with which (work for tomorrow...)

berak gravatar imageberak ( 2015-09-17 17:34:09 -0500 )edit

how do i extract features using AKAZE and store in a file in android ?

Pallavi gravatar imagePallavi ( 2015-09-30 02:16:32 -0500 )edit