OpenCV4Android SDK configuration on Win 8.1 platform, opencv4androidsdk

Source: Internet
Author: User
Tags android sdk manager

OpenCV4Android SDK configuration on Win 8.1 platform, opencv4androidsdk

This article mainly records the process of installing and configuring the OpenCV4Android SDK. My installation environment is: win8.1 64-bit.

Of course, before developing opencv, it is best to have some development experience, such:
1. java Development on Android
2. Java Native Interface (JNI): Technology for running local code on a Java Virtual Machine
3. Android Activity and its lifecycle, which are the essence of android Development
4. Knowledge about Android camera development.

Many errors have occurred during the configuration of ADK, Eclipse, and ADT, despite the use of many online tutorials. The process of these tutorials is roughly the same, but many errors will occur after a build. Later, I was recommended by the Forum to try to use the full set of TADP (Tegra Android Development Pack) released by NVIDIA, including installation packages such as ADK, Eclipse, NDK, and OpenCV, all environment variables and related plug-ins are automatically configured during installation. TADP mainly includes the following content:

Android Development:    Android SDK r24.0.2    Android APIs    Android NDK32 and NDK64 r10d    Android Build Tools r21.1.2    Android Platform Tools r21    Android Support Library r21    Android Support Repository Lbrary r9    Google USB Driver r11    JDK 1.7.0_71    Eclipse 4.3, CDT 8.2.0, ADT 24.0.2    Apache Ant 1.8.2    Gradle 2.2.1Tegra Libraries and Tools:    Tegra Graphics Debugger 1.3 (Win/OSX/Linux)    Nsight Tegra 2.1, Visual Studio Edition (Win)    Tegra System Profiler 2.2 (Win/OSX/Linux)    CUDA 7.0 BETA on NVIDIA Tegra X1 devices (available on Linux x64 on select devices only. See documentation for details.)    CUDA 6.5 on NVIDIA Tegra K1 devices (available on Linux x64 on select devices only. See documentation for details.)    PerfKit 4.3 (Win/OSX/Linux)    PerfHUD ES 2.2 [NVIDIA SHIELD support requires OTA Update 65+]    OpenCV for Tegra 2.4.8.2    PhysX 3.3 for Android    Google Nexus 9 Tablet Support for NVIDIA Tegra K1 64-bit mobile processor. Note: CUDA is not supported on Nexus 9.    NVIDIA SHIELD Android TV Support    NVIDIA SHIELD Tablet Support    NVIDIA SHIELD Tools Support    NVIDIA Tegra NOTE 7 Tools Support    Google Project Tango Tablet Development Kit Tools SupportTegra Samples, Docsand Devices Support    NVIDIA GameWorks OpenGL Samples 2.1    Tegra SDK Samples    Tegra SDK Documentation    Tegra X1 64-bit Based Device Support    Tegra K1 64-bit Based Device Support    Google Project Tango Tablet Development Kit Tools Support

:
Https://developer.nvidia.com/tegra-android-development-pack

Note: The NVIDIA Tegra Android Development Kit includes some features of the NVIDIA Tegra platform, but it is not limited to Tegra devices. The official website mentioned that TADP is applicable to 64-bit windows. However, in actual use, it was found that the Eclipse downloaded and installed by TADP is a 32-bit version and cannot be compatible with the 64-bit JDK. An error occurred: java was started but returned exit code = 13. For my own errors, we recommend that you use a 64-bit system to download Eclipse 4.3 64-bit version + ADT.

After you have prepared TADP and the Eclipse 4.3 64-bit ++adt, you can start the installation and configuration of the entire set, open tadp-4.0r1-windows.exe, and prompt you to set the path and installation path of the downloaded package:

Go to the download and installation page, select the required components (do not check eclipse and ADT here), and click next to automatically download. During the installation process, you will be prompted for Accept License:

After the installation is complete, restart the computer. Besides eclipse and ADT, the installation is complete. Decompress Eclipse 4.3 64-bit to the installation path of TADP, enable eclipse, and set a Workspace. The next step is to install ADT.

The steps for installing ADT are as follows:
1. In the menu bar of Eclipse, find: Help-> Install New Software

2. In the "Install" dialog box, select "Add ...", In the displayed dialog box, name the ADT plug-in and specify the path of the ADT plug-in installation package:

3. Click "OK". The installation list of the ADT is displayed. Select All and click "Next" to install the ADT.

During this period, there may be warnings. pass them directly ~

4. Restart eclipse after installation. The following dialog box is displayed. The installation is successful!

5. In the Eclipse menu bar, find Window> Preferences and click the Android tab to view the installed Android API.

6. at this time, Android SDK Manager and Android Virtual Device Manager cannot be found in eclipse. Therefore, you need to set the ADK path and go to Window> Preferences> Android in the menu bar, select the path of the Android SDK (found in the installation path of TADP ):

7. In the displayed dialog box, select Use existing SDKs and make sure that the Existing Location is the installation path of the Android SDK:

8. After completing a series of operations, restart eclipse. You can see in the menu bar Window:

Now the entire environment has been set up!

I am a gorgeous splitting line

Part 2Is there a problem to demonstrate the OpenCV demo Test Development Environment. We need to import the OpenCV library and examples into the workspace. After the OpenCV library is packaged as an android library project, it is provided for the android project. Just reference it. Every example references a common android project of the opencv library, so you must open the example and do not forget the pilot warehouse receiving project. The procedure is as follows:

1. Open eclipse and find: File-> import: on the menu bar:

2. Open General> Existing Projects into Workspace> next:

3. In the following dialog box, click finish to load all selected projects to the workspace and start Compilation:

4. Read the Problems window and there are many errors... There are many different solutions for these problems on the Internet. Here I will only provide my own solutions:

5. Solution steps:
A. Right-click the OpenCV Library Project-Android Tools-Fix Project Properties; then project-Clean all Project;

B. find the android project with the error message and modify the project under the project directory. in the properties file, the content of target = android-XX and XX is changed to the android SDK version installed on your machine. These versions can be viewed in Windows-> Preferences-> Android.

C. If other errors occur in the problems view, you can check whether the Code has other problems.

6. After step B is completed, all errors disappear. Then you can run the OpenCV instances. If you have an Android phone, connect to your computer via USB, right-click a project, and select "Android Application" in the "Run As" window ".

7. then an error occurs in The Console because The connection to adb is down, and a severe error has occured. if the adb.exe path is correct, try: help-> Check for update, Check for updates, and restart eclipse. The problem is solved...

8. When running the OpenCV project on an Android phone, make sure that OpenCV Manager is installed on your phone. Otherwise, the following message is displayed:

9. The demo runs successfully! You can start OpenCV4Android development!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.