GithubHelp home page GithubHelp logo

opencv-repackaged's Introduction

OpenCV-Repackaged

What exactly is this?

This is the OpenCV Java API, repackaged into an AAR that you can add as a Gradle dependency to your Android Studio project. This is exactly the same thing that is in the /sdk/java folder of the OpenCV Android bundle.

Why in the world would I want to use this?

To avoid the pain of having to download the OpenCV Android bundle, extract the Java library, and import it as a module in Android Studio. This bloats your git repository and makes it a pain to upgrade to a newer OpenCV version. However, that's not even the biggest benefit of using this library! To decrease the final APK size (and thus decreasing deployment time to your robot each time you make a code change), this library loads the C++ library required by OpenCV (more than 10MB!) dynamically from the internal storage instead of shipping it inside the APK.

Device compatibility:

Unfortunately, due to a known bug with OpenCV 4.x, OpenCV-Repackaged is only compatible with devices that run Andorid 5.0 or higher. For FTC, this means that it is incompatible with the ZTE Speed. OpenCV-Repackaged will work fine on all other FTC-legal devices (including the new Control Hub).

So how do I use this?

  1. Open your FTC SDK Android Studio project

  2. Open the build.common.gradle file:

    img-her

  3. Add jcenter() to the repositories block at the bottom:

    img-her

  4. Open the build.gradle file for the TeamCode module:

    img-her

  5. At the bottom, add this:

     dependencies {
         implementation 'org.openftc:opencv-repackaged:4.1.0-C'
      }
    
  6. Copy libOpenCvNative.so from the /doc folder of this repo into the FIRST folder on the USB storage of the Robot Controller (i.e. connect the Robot Controller to your computer with a USB cable, put it into MTP mode, and drag 'n drop the file).

  7. You can now use OpenCV just as you would as if you had manually imported the module, with one minor difference being you do not need to call any methods such as OpenCVLoader.initDebug() because the native library is automatically loaded in the background when the SDK boots.

Changelog:

v4.1.0-C

  • Specifically handle error case of failure to load 32-bit library when FTC Robot Controller app has already loaded another native library as 64-bit

v4.1.0-B

  • Drastically improve error handling when loading native library

v4.1.0-A

  • Initial release, based on OpenCV Android SDK v4.1.0

opencv-repackaged's People

Contributors

frogbots4634 avatar windwoes avatar noahandrews avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.