Skip to content

onuralpszr/DepthAiAndroidToolbox

Repository files navigation

DepthAiAndroidToolbox

MIT Kotlin Gradle JetpackCompose OpenCV Conventional Commits android-studio luxonis-depthai-core

ktlint

DepthAi Android Toolbox Application For OAK-D Devices

Description

This Android application that utilizes the OAK-D camera and OpenCV library to perform YOLOv5 object detection and depth detection. The OAK-D camera provides high-quality images and videos with advanced depth sensing capabilities, while OpenCV is a widely-used computer vision library that provides various image processing and analysis tools.

With this application, users can take advantage of the OAK-D camera's advanced features to detect and track objects in real-time. The YOLOv5 model is used for object detection, which is a state-of-the-art deep learning model that can recognize a wide range of objects with high accuracy. The depth detection feature enables users to obtain information about the distance between objects in the scene, which can be useful for various applications such as robotics, autonomous driving, and augmented reality.

This project needs to OpenCV 4.7.0 (and other 4.x.y versions) for Android in Android Studio with Native Development Kit (NDK) support. Android NDK enables you to implement your OpenCV image processing pipeline in C++ and call that C++ code from Android Kotlin/Java code through JNI (Java Native Interface).

Get Submodules

Make sure submodules are initialized and updated

git submodule update --init --recursive

How to use this repository

  1. Download and Install Android Studio

  2. Install NDK and CMake

  3. Clone this repository as an Android Studio project :

    • In Android Studio, click on File -> New -> Project from Version Control -> Git
    • Paste this repository Github URL, choose a project directory and click next.
  4. Install OpenCV Android release :

    • Download OpenCV 4.7.0 Android release or download latest available Android release on OpenCV website.

    • Unzip downloaded file and put OpenCV-android-sdk directory next your project and rename folder opencvsdk470. If you want to place somewhere else please change path in settings.gradle

    • Optional(For linux) you can run setupOpenCV.sh for automatic download and setup gradle file for opencv

  5. Open your opencv build.gradle and change your compileSdk,minSdkVersion,targetSdkVersion same as your main project. Due to gradle 8.0 you also gonna need to add namespace and enable aidl build config and set min JDK to 17.

    namespace 'org.opencv'

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17
    }

    buildFeatures {
        aidl true
    }

  1. Sync Gradle and run the application on your Android Device!

Keywords

Kotlin, OpenCV 4, Android, Android Studio, Native, NDK, Native Development Kit, JNI, C++,

About

DepthAi Android Toolbox Application For OAK-D Devices

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages