Skip to content

Opix/OpenCV5-Contrib-Android

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCV5-Contrib-Android

OpenCV 5.x SDK plus opencv_contrib for Android. You can simply get the repo and add to your Droid project.

Or you can compile by yourself with your specific versions on your Mac. Some helpful links:

  1. git pull. Make sure the branch is 5.x. Do the same for opencv_contrib as well. They should be under the same parent folder.
  2. Go to the opencv folder. Create a folder called build.
  3. Delete everything under opencv/build every time you run the python command below.
  4. Important: Find the right NDK version (/Users/xxx/Library/Android/sdk/ndk/28.2.13676358) based on Android Gradle Plugin (AGP) version. For AGP 9.2.1, NDK = 28.2.

If they don't match, then OpenCVLoader.initLocal() in your Android app will fail even though you can still generate the library.

  1. Make changes as follows (or pick your own version numbers):
Screenshot 2026-06-27 at 11 13 05 PM Screenshot 2026-06-27 at 11 13 29 PM Screenshot 2026-06-27 at 11 13 57 PM
  1. Run the code below in Terminal (at opencv). xxx should be your own username. Again, make sure you change the "28.2.13676358" part for your specific needs.
python3 platforms/android/build_sdk.py \
build \
--ndk_path=/Users/xxx/Library/Android/sdk/ndk/28.2.13676358 \
--sdk_path=/Users/xxx/Library/Android/sdk \
--extra_modules_path=../opencv_contrib/modules \
--config=platforms/android/ndk-25.config.py \
--use_android_buildtools \
--no_samples_build

↑ Takes time. Just be patient...
Notice the last line: the sample project is not part of this build. Delete the line if you want.

About

OpenCV 5.x SDK plus opencv_contrib for Android

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors