1

Just as the title says. I tried "Import Project" then selected this file:

C:...\OpenCV-2.4.10-android-sdk\samples\tutorial-1-camerapreview

Then selected this folder as the location for the full copy of the project:

C:...\AndroidStudioProjects\tutorial-1-camerapreview4

I then get the following warnings:

  • Project OpenCV Tutorial 1 - Camera Preview:C:\Users\Michael\OpenCV-2.4.10-android-sdk\samples\tutorial-1-camerapreview\project.properties: Library reference ....\sdk\java could not be found Path is C:\Users\Michael\OpenCV-2.4.10-android-sdk\samples\tutorial-1-camerapreview....\sdk\java which resolves to C:\Users\Michael\OpenCV-2.4.10-android-sdk\sdk\java

Can anyone help please? searches for answers so far have not been fruitful.

1 Answers1

2

From the existing project where you have configured to include OpenCV module, use "Import Module" to import opencv samples.

Ha Dang
  • 1,218
  • 1
  • 10
  • 12
  • Thanks, I am currently trying to statically initialize opencv. I created a new project. Imported the opencv module and the sample module. I then added the following code at the start of my Activity class: static { if (!OpenCVLoader.initDebug()) { // Handle } } I then added the following after "super.onResume": mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS); And then deleted this: OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_3, this, mLoaderCallback); I then get the following error: OpenCV error: Cannot load info library for OpenCV – MichaelAndroidNewbie Feb 16 '15 at 21:27
  • So, the "Import Module" answer works for you? If so, please accept the answer. – Ha Dang Feb 17 '15 at 07:42
  • 1
    For your other problem in your comment, I recommend you to read this [link](http://docs.opencv.org/trunk/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#application-development-with-static-initialization) to setup properly the statical initialization of OpenCV for your project. – Ha Dang Feb 17 '15 at 07:44
  • Sorry, I've accepted it now. Yes I have been trying to follow that but those instructions seem to be written for eclipse and I don't know how to do it in android studio. I am stuck on stage 2: "select Project -> Properties -> Android -> Library -> Add select OpenCV Library - 2.4.9;"... I can't find a "Project" or "project properties" button anywhere. – MichaelAndroidNewbie Feb 17 '15 at 16:52
  • IMHO, if you already used "Import Module" to import OpenCV4Android in Android Studio, you can skip the step 1&2 and go directly to step 3. – Ha Dang Feb 18 '15 at 07:53
  • Yes that makes sense. The next step says: If your application project doesn’t have a JNI part, just copy the corresponding OpenCV native libs from /sdk/native/libs/ to your project directory to folder libs/. How do I know if my app has a JNI part? I googled it and it says it is just an interface that allows java to be called by native applications written in other languages. – MichaelAndroidNewbie Feb 18 '15 at 10:03
  • You may try the answer of this [thread](http://stackoverflow.com/questions/27406303/opencv-in-android-studio) – Ha Dang Feb 18 '15 at 11:17
  • I've followed this link already but I am getting: "OpenCV manager was not found, would you like to install it?" when I try to run the program... I have so far used import project to import the openCvtutorial1preview, then used "import module" to import the opencv library. I then let gradle re-build. I then went through "my computer >...> OpenCV-2.4.10-android-sdk > sdk > native > libs" and copied the 4 folders within into my project under "src>main>libs" & renamed it jnilibs. – MichaelAndroidNewbie Feb 18 '15 at 13:43
  • I checked the dependencies under "Project Structure > openCVTutorialCameraPreview > Dependencies" and "openCVLibrary2410" is already listed there. I then copy and pasted this: static { if (!OpenCVLoader.initDebug()) { // Handle initialization error } } into Tutorial1Activity under the variable declarations – MichaelAndroidNewbie Feb 18 '15 at 13:44
  • For the message "OpenCV manager was not found, would you like to install it?", please select yes/install. – Ha Dang Feb 18 '15 at 21:06
  • For your other question about native dependencies, please post as a new question and describe it properly. The help may come hopefully. – Ha Dang Feb 18 '15 at 21:07
  • I solved it in the end, a few days of fiddling around worked out. Thanks for all of your help! – MichaelAndroidNewbie Feb 18 '15 at 22:16