OpenCV library package not found

那年仲夏 提交于 2019-12-23 08:33:15

问题


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!


回答1:


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




回答2:


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!



来源:https://stackoverflow.com/questions/30836039/opencv-library-package-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!