Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV library package not found

I've been trying to run the "OCV 15 Puzzle" sample app for Android provided by OpenCV, but it's not working; every time I try to run the app a message appears saying: "Package Not Found, OpenCV library package was not found! Try to install it? Yes/No". I press, "Yes" and then I get prompted to a new message saying: "OpenCV Manager, Package Installation Failed!".

I installed OpenCV manager from Google Play, so in theory I should be able to run the sample app. I've also been searching everywhere for a solution and so far I have had 0 success. I am using a Samsung Galaxy mini S3 to run the app. (Android Ver. 4.1.2).

Any help is greatly appreciated folks!

like image 923
MrRed Avatar asked Jun 15 '15 00:06

MrRed


2 Answers

The OpenCV Manager available on Google Play is for the 2.4 branch of OpenCV. Since you were using the 3.0 sdk this error is expected.

The OpenCV Manager for the 3.x branch is not available on Google Play, instead you have to manually upload the apk file corresponding to the hardware platform you are targeting. The OpenCV_3.0.0_Manager_3.00_*.apk files are located in the apk directory of the sdk download.

Once you install the correct OpenCV Manager it should work.

Alex

like image 57
bing Avatar answered Sep 29 '22 19:09

bing


Alright, well I solved the problem by getting rid of OpenCV Manager, and using the library version of OpenCV-android-2.4.11 instead of 3.0. In short, what I did was:

  1. Download OpenCV-android-sdk-2.4.11
  2. Unzip it
  3. Right click on Package Explorer and "Import" an existing project in workspace by loading "OpenCV Library 2.4.11" as well as "15 Puzzle" from the folder you just unzipped.
  4. Right clicking on 15 Puzzle project folder >> Properties >> Android >> Add the OpenCV Library 2.4.11
  5. Right click again on 15 Puzzle folder and create a new folder named "libs"
  6. Copy all the folders from OpenCV-android-sdk/sdk/native/libs into the libs folder you just created.
  7. Right click on the project folder >> Properties >> Build Path >> Order and Export >> Check the box next to "Android (some number)" if it is unchecked
  8. Go to src folder >> org.opencv.samples.puzzle15 >> Puzzle15Activity.java and edit it by adding

    static { if (!OpenCVLoader.initDebug()) { // Handle initialization error } }

right after the global variables and comment out the line

OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);

located in the overridden method "OnResume()".

After all this I ran it on my phone and it worked! I hope this helps someone who's about to throw their computer out of the window out of frustration. Cheers!

like image 32
MrRed Avatar answered Sep 29 '22 20:09

MrRed