OpenCV

OpenCV, short for Open Source Computer VisionLibrary, is written based on C/C++. It is a Computer vision development framework under BSD Open Source license. Its Open Source license allows it to be used for free in academic research and commercial application development. OpenCV supports application development on Windows, Linux, Mac OS, iOS and Android operating systems.

OpenCV Android SDK

The OpenCV Android SDK is a development kit provided by OpenCV for the Android platform. Android application development generally uses Java or Kotlin language, and OpenCV main module uses C, C++ language, therefore, we need to achieve the purpose of Java or Kotlin call OpenCV algorithm module through JNI technology.

download

  • Download website address (https://opencv.org/releases/)
  • Select Android under The OpenCV version

An overview of the SDK

The SDK directory structure is as follows:

OpenCV-android-sdk

|_ samples

|_ sdk

| |_ etc

| |_ java

| |_ libcxx_helper

| |_ native

| |_ 3rdparty

| |_ jni

| |_ libs

| |_ arm64-v8a

| |_ armeabi-v7a

| |_ x86

| |_ x86_64

| |_ staticlibs

| |_ arm64-v8a

| |_ armeabi-v7a

| |_ x86

| |_ x86_64

|

|_ LICENSE

|_ README.android

Copy the code
directory file
samples OpenCV run case
sdk OpenCV API and dependent libraries
sdk/etc Haar and LBP cascade classifier
sdk/java OpenCV Java API
sdk/libcxx_helper bring libc++_shared.so into packages
sdk/native OpenCV static library, dynamic library and JNI file

English in detail (https://opencv.org/android/). In fact, the official introduction is not very detailed, and much of the material has become obsolete over the iterations of the version. The only thing that is readable and instructive is the code and comments in the library.

The development environment

  • Android Studio 3.5.3 & Android SDK

  • Android the NDK 20.1.5948944

  • CMake 3.10.2

  • OpenCV 4.2.0 Android SDK

Hello OpenCV Android Sample

  • Open Project
  • Select the samples directory under the Opencv-Android-SDK directory
  • Run face-detection after the compilation is complete
Face Detection running results

Hello OpenCV Android SDK

  • New Project
  • Import Module…
  • Select the SDK directory under the opencv-Android-SDK directory and change or leave the module name unchanged
  • Add app dependencies on SDK Module
  • Some problems may occur during the NDK version, API LEVEL, or build Tools problems.

The sample project

Github.com/onlyloveyd/…


This article is formatted using MDNICE