2014年6月26日 星期四

OpenCV on Android

I: Install OpenCV for Android

Downloading and Installing Android NDK

The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++.

1. Download the latest version of the NDK from this website:
    http://developer.android.com/tools/sdk/ndk/index.html
2. Unzip the downloaded file to a location without spaces in the path, for example:
    C:\\Development\android-ndk-r9d
3. Define NDKROOT as a new environment variable pointing to the unzipped location from
    the previous step.

Updating Tools in Android SDK

1. In Eclipse, click Help > Install New Software. Then, click Add.
2. In the Add Repository dialog, enter “ADT Plugin” for the Name and the following URL for
    the Location, and click OK:
    https://dl-ssl.google.com/android/eclipse/
3. In the Available Software dialog, select all listed components. Click Next. Accept all license agreements. Click Finish.
4. Restart Eclipse after all the tools have been downloaded and installed.

Downloading and Installing OpenCV SDK

1. Download version 2.4.4 (or higher) of the SDK from this website:
    http://sourceforge.net/projects/opencvlibrary/files/opencv-android/
2. Unzip the downloaded file to a location without spaces in the path, for example:
    C:\\Development\OpenCV-2.4.9-android-sdk
3. In Eclipse, select File > Switch Workspace > Other. Specify a location associated with OpenCV projects, for example:
C:\\Development\OpenCV-2.4.9-android-sdk
4. Right-click in the Package Explorer panel and choose Import > General > Existing Projects into Workspace. Select “Specify root directory” and input the location where the SDK contents were unzipped, for example:
C:\\Development\OpenCV-2.4.9-android-sdk
5. After seeing the OpenCV library and sample projects appear in the “Projects” box, click Finish. It may take a minute for all the projects to be loaded and initialized. Thereafter, you have the projects imported into the workspace

II: Run OpenCV Applications on Physical Phone

Running OpenCV Samples

1. Connect your phone to PC via USB Cable
2. Make sure your device manager shows (Android Composite) ADB Interface, if no please check driver installation

3. Install the OpenCV Manager app from the Google Play Market onto your phone
link: https://play.google.com/store/apps/details?id=org.opencv.engine
4.In Eclipse, click on any of the sample OpenCV projects. Then, click Run > Run As > Android Application. You can monitor the installation status in the Console.

Troubleshooting 

Ref:
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html#development-in-java 


1."The container 'Android Dependencies' references non existing library 'C:\Project\android-sdk-windows\tools\support\annotations.jar'.



Sol:change the target API version from 11 to 19


2. OpenCV in not ready (OpenCV Manager app not be install)


 
Sol: Download App's apk file on Google Play without Google account

a. get the app's link from Google Play page
Ex:https://play.google.com/store/apps/details?id=org.opencv.engine

b. go to App Downloader website
http://apps.evozi.com/apk-downloader/?id=org.opencv.engine

c. post link get from step a in website
d. get the apk file org.opencv.engine.apk
e. cmd adb install org.opencv.engine.apk

沒有留言:

張貼留言