Androidstudio OPENCV configuration without installing OpenCV Manager

Source: Internet
Author: User

Follow these steps to configure and test, no problem.

  1. Download OpenCV SDK for Android, unzip (my decompression address is F:\OPENCV-ANDROID-SDK)

  2. 1) New Project project, named Opencvtest (name Random)

    2) Minimum SDK selection API 19:android 4.4 (KitKat)

    3) Select Empty Activity

  3. Android Studio Menu-->file-->new-->import Module

    1) Select F:\opencv-android-sdk/sdk/java

    2) Module name:android Studio will automatically populate this entry for openCVLibrary310 without having to control it.

    3) Click Next, there will be three check boxes, all selected, click Finish

  4. 1) File-->project Structure

    2) Select App under the left modules bar

    3) Select dependencies in the upper right column

    4) Click "+" in the right column to select the third module Dependency

    5) Click OK to exit, and then click OK to exit

  5. 1) Switch the view from Android to project,

    2. Tap the app to open the Build.gradle file in the app root directory and write down

    Compilesdkversion

    Buildtoolsversion

    Minsdkversion

    Targetsdkversion

    The following values

    3) Click OpenCVLibrary310, open the root directory of the Build.gradle file, put the file

    Compilesdkversion

    Buildtoolsversion

    Minsdkversion

    Targetsdkversion

    Changes to the same value in the app.

    4) Click Try Again in the top Gradle Project sync row

  6. 1) Copy the Libs folder under F:\OpenCV-android-sdk\sdk\native under the OpenCV SDK for Android file to your Android project, under Opencvtest\app\src\main, and renamed Libs to Jnilibs.

    2) At this time the preparatory work is completed, the next can be used in the OPENCV program test

    3) Open your main activity Mainactivity.java file, write down the package name, mine is

    Package com.xiaoma.opencvtest;, then my bag name is Com.xiaoma.opencvtest

  7. 1) Copy the three files in the Opencv-android-sdk\samples\image-manipulations\res () to your Android project opencvtest\app\src\main\ Res (delete three files of the same name in this directory before copying)

    2) Copy the Androidmanifest.xml file from Opencv-android-sdk\samples\image-manipulations to your Android project Opencvtest\app\src\main replace

    3) The Opencv-android-sdk\samples\image-manipulations\src\org\opencv\samples\ Copy the Imagemanipulationsactivity.java file from Imagemanipulations to your Android project Opencvtest\app\src\main\java\com\xiaoma\ Opencvtest, and delete the original Mainactivity.java file. Where \com\xiaoma\ is different depending on the package name of each person.

  8. 1) Open Imagemanipulationsactivity.java,androidmanifest.xml in Android Studio

    2) Replace the package name in the file with the package name you noted in the sixth step

    3) Change the value of Uses-sdk android:minsdkversion under the Androidmanifest.xml file to the value noted in step five

    4) Note This step in the Androidmanifest.xml file to change the package name, do not put the original "" Paste lost

  9. Some hands may eject when they are running.

    It seems that the device does not the support camera (or it's locked). Application'll be closed.

    At this time to open the mobile app Rights Management, find the application of the program, the permission to change its camera to allow it

Androidstudio OPENCV configuration without installing OpenCV Manager

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.