4

I cannot make the sample (Facedetection) coming with the OpenCV4Android work in Android Studio.

Is there a tutorial for facedetection that would address the users of Android Studio? Because it does not work to import the Eclipse project that is attached to the library as sample. I am sure it's because of the NDK dependency, but I cannot seem to get it to work. I installed the NDK, added it to the Path, still no change.

Better yet, is there any way of avoiding the use of the NDK in a facedetection application?

I would appreciate any help in making this work in the Android Studio

user1137313
  • 2,390
  • 9
  • 44
  • 91
  • http://stackoverflow.com/questions/28865416/ndk-dir-error-in-android-studio/28879280#28879280 – VVB Mar 09 '15 at 04:57
  • 4
    There is a new Android Face API available. It includes tutorials, and quick setup instructions for building the samples in Android Studio: https://developers.google.com/vision/getting-started – pm0733464 Aug 20 '15 at 19:36
  • I solved this by installing correct OpenCV manager from opencv/apk/-manager.apk try installing different managers if you don't know phone cpu architecture. – Shivaraj Patil Jan 19 '17 at 10:21
  • You may also have a look at [this](https://stackoverflow.com/a/40746665/3051961) to get a fair idea of how to integrate OpenCV with Android Studio – ZdaR Mar 15 '18 at 04:25
  • @ZdaR: Please try to import the face-detection sample provided by OpenCV (for Android) from Android Studio and see whether your answer makes sense here. – Second Person Shooter Mar 15 '18 at 23:35
  • @ArtificialStupidity This is comment section and not Answers section. People interact here to get concrete understanding of the problem. It was just a suggestion to see if OP has already integrated the OpenCV with Android Studio. But anyways, can you provide me the links you have been following to solve the problem ? – ZdaR Mar 17 '18 at 05:09
  • @ZdaR: I have the same problem and no solution, see [my comment](https://stackoverflow.com/questions/28935066/opencv-face-detector-sample-in-android-studio?noredirect=1#comment85584086_34148927). – Second Person Shooter Mar 17 '18 at 06:37
  • The default OpenCV samples rely on OpenCV Manager app separately installed on your device. So you want the same configuration or you want to include OpenCV dependencies inside your stand alone app? Generally we build android apps which are stand alone and do not require any other dependencies. – ZdaR Mar 18 '18 at 06:16

1 Answers1

3

I've just uploaded to github a simple sample using OPENCV libraries. Everything is setup already to get it to run really quick. My AndroidStudio is 2.0 Preview 2 (released 5 days ago). Hope isn't too late or at least others may find it useful for quick troubleshooting during installation.

Best.

Eduardo Gomez
  • 425
  • 3
  • 12
  • Have you tried this in android studio 1.5.1? I tried importing your code and i got the following "Error NDK integration is deprecated to the current plugin " It would be so helpful to get this code running. Any tips? – Jared Smith Feb 05 '16 at 03:37
  • Probably your NDK version might be a bit old. Is there some reason to do not try AS 2.0? – Eduardo Gomez Feb 05 '16 at 04:35
  • Thanks for posting helps a lot, I'm getting this error I have added all .so files but still it says "java.lang.UnsatisfiedLinkError: dlopen failed: library "/data/app/org.opencv.engine-1/lib/arm64/libopencv_java.so" not found" and may I know what all other things I need to change to make it work? Android.mk or Application.mk so on anything else I need to change? – Shivaraj Patil Jan 10 '17 at 06:06
  • Could you make a complete answer how to import the sample from within Android Studio? I am using the newest version of both. – Second Person Shooter Mar 15 '18 at 02:07
  • I followed [this tutorial](https://web.stanford.edu/class/ee368/Android/Tutorial-2.pdf) but its contents seems to be out of date. It does not reflect the newest version. – Second Person Shooter Mar 15 '18 at 02:16
  • @ArtificialStupidity what kind of problem did you have? – Eduardo Gomez Mar 15 '18 at 18:57
  • I cannot import the existing Eclipse sample projects (for example face-detection) provided in the latest OpenCV (for Android) from within Android Studio (the latest version). I already followed the guidance provided by Stanford University's Electrical Engineering notes given in my previous comment. – Second Person Shooter Mar 15 '18 at 23:34
  • I find difficult I can make a step-by-step tutorial for you right now. It could be better to follow this guide first https://developer.android.com/ndk/samples/sample_hellojni.html and then having Android Studio up-to-date attempt integrating OpenCV. I'm not really familiar with the conversion process Eclipse does and will hopefully save you time to get you up and running. – Eduardo Gomez Mar 16 '18 at 04:15