Skip to content

de-men/opencv-android-prefab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

opencv-android-prefab

This compile only necessary modules of OpenCV in C++ and Android NDK then use Prefab for easy to use. With using this lib, we can reduce size by only using what necessary modules. We can deliver our library that depends on opencv without missing libopencv_world.so error.

This library only use for Cpp native development, not include Java code.

Prepare your release by assigning a version (remove the -SNAPSHOT suffix)

cd [module]
./gradlew publish --no-daemon --no-parallel
./gradlew closeAndReleaseRepository

Using for Native Android module

Use wildcard opencv_world module

Use this dependency then you don't need to care about dependencies of each modules. opencv_world include all opencv modules.

In the app/build.gradle file

android {
    buildFeatures {
        prefab true
    }
}

dependencies {
    implementation 'org.demen.android.opencv:opencv_world:1.0.0'
}

In the app/main/cpp/CMakeLists.txt

find_package(opencv REQUIRED CONFIG)

target_link_libraries( # Specifies the target library.
        native-lib
        opencv::opencv_world
        )

Use separate modules

Use this dependency to optimize the app size. Only link with libraries that you need for the app.

In the app/build.gradle file

android {
    buildFeatures {
        prefab true
    }
}

dependencies {
    implementation 'org.demen.android.opencv:opencv:1.0.1'
}

In the app/main/cpp/CMakeLists.txt

find_package(opencv REQUIRED CONFIG)

target_link_libraries( # Specifies the target library.
        native-lib
        opencv::opencv_core
        opencv::opencv_imgproc  # Or other modules
        )

Use in cpp file

#include <opencv2/core.hpp>
const auto info = cv::getBuildInformation();

About

OpenCV prefab library for Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published