A tutorial on configuring the OpenCV Library development environment in Android Studio _android

Source: Internet
Author: User
Tags svn

1, download
go to the official website (http://opencv.org/) download opencv4android and unzip. The directory structure is shown in the following figure.

The SDK directory is the class library that we need to develop OPENCV, and the Samples catalog contains several OPENCV application examples (including face detection) that can provide us with a reference for OPENCV development under Android The doc directory is the usage description and API documentation for the OpenCV class library, and the APK directory holds the opencv_2.4.3.2_manager_2.4 application installation package corresponding to each kernel version. This application is used to manage the OpenCV class library in mobile devices, and before running OPENCV applications, it is necessary to ensure that opencv_2.4.3.2_manager_2.4_*.apk is installed on the phone. Otherwise the OPENCV application will not run because the OpenCV class library cannot be loaded (the next article describes how to run OpenCV without installing OpenCV Manager in advance).
2, will opencv into the Android Studio
Select File->import Module in the Android studio to find the OpenCV unzipped path and select the Sdk/java folder.

3, update build.gradle information
in the upper left corner of Android studio, select Project View, in the oepnCVLibrary2411 folder, Open Build.gradle (There are many files with duplicate names, be sure to look for the OpenCV library file), modify the file in 1) compilesdkversion 2) buildtoolsversion 3) minsdkversion 4) targetsdkversion its content in accordance with the information in the Build.gradle under the app folder. Click the try again in the yellow tip box above to update.

4. Add Module Dependency
Right-click the app folder, select Open Module Settings, and in the dependencies of App Module, click the green plus sign in the upper-right corner to add openCVLibrary2411 and click OK.

5, copy the Libs folder to the project
in the OpenCV unpack package, copy the Sdk–>native–>libs folder, paste it in the App–>src–>main directory under Project view, and rename it to Jnilibs.
Since then, the OPENCV environment has been configured. You can put the layout files, Java files, Opencv-android-sdk–>samples–>tutorial-1-camerapreview in the project, Modify the Androidmanifest.xml, add the right to use the camera, you can test whether the success.
6, configure SVN ignore file ignored
creating a project with Android studio automatically generates the. gitignore file in the root directory and the module directory, which looks like git's configuration file, and SVN doesn't matter.
Open setting-version control-ignored files, add ignore file, I know the ignored file as follows:

Note that configuration ignores files must be done before share to SVN, and if configured after a commit, it does not seem to work.
When a share is configured to ignore files and project to SVN, others check them out without having to configure them and automatically ignore those files when they commit. But the filename appears red, then the configuration ignores the file to return to normal.
Check down for project:

After configuring ignoring files:

Related Article

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.