From 88b994d8190d5f0e882a58788e130e50414f9c4b Mon Sep 17 00:00:00 2001 From: TimPushkin Date: Sat, 21 May 2022 19:43:53 +0300 Subject: [PATCH] Rename project --- .github/workflows/android.yml | 4 ++-- .github/workflows/native.yml | 10 +++++----- README.md | 10 +++++----- app/build.gradle | 6 +++--- app/src/main/AndroidManifest.xml | 4 ++-- .../MainActivity.kt | 14 +++++++------- .../ui/AppState.kt | 4 ++-- .../ui/Menu.kt | 2 +- .../ui/ResultsScreen.kt | 2 +- .../utils/Conversions.kt | 2 +- .../utils/StorageUtils.kt | 2 +- app/src/main/res/values/strings.xml | 2 +- app/src/main/res/values/themes.xml | 2 +- settings.gradle | 4 ++-- {sgbmandroid => sgbmdepth}/.gitignore | 0 {sgbmandroid => sgbmdepth}/build.gradle | 2 +- {sgbmandroid => sgbmdepth}/consumer-rules.pro | 2 +- {sgbmandroid => sgbmdepth}/proguard-rules.pro | 0 .../src/main/AndroidManifest.xml | 0 .../src/main/cpp/.clang-tidy | 0 .../src/main/cpp/.gitignore | 0 .../src/main/cpp/BuildOpenCV.cmake | 0 .../src/main/cpp/CMakeLists.txt | 2 +- .../src/main/cpp/CPPLINT.cfg | 0 .../src/main/cpp/README.md | 2 +- .../src/main/cpp/examples/CMakeLists.txt | 0 .../src/main/cpp/examples/GetDepthExample.cpp | 2 +- .../main/cpp/examples/images/calib_params.xml | 0 .../main/cpp/examples/images/clothes_l.png | Bin .../main/cpp/examples/images/clothes_r.png | Bin .../src/main/cpp/external/CMakeLists.txt | 0 .../main/cpp/external/log-lib/CMakeLists.txt | 0 .../main/cpp/external/opencv/CMakeLists.txt | 0 .../src/main/cpp/include/DepthEstimator.h | 18 +++++++++--------- .../src/main/cpp/src/CMakeLists.txt | 2 +- .../src/main/cpp/src/Constants.h | 10 +++++----- .../src/main/cpp/src/Conversions.h | 6 +++--- .../src/main/cpp/src/DepthEstimator.cpp | 4 ++-- .../src/main/cpp/src/Logging.h | 6 +++--- 39 files changed, 62 insertions(+), 62 deletions(-) rename app/src/main/java/me/timpushkin/{sgbmandroidapp => sgbmdepthapp}/MainActivity.kt (93%) rename app/src/main/java/me/timpushkin/{sgbmandroidapp => sgbmdepthapp}/ui/AppState.kt (85%) rename app/src/main/java/me/timpushkin/{sgbmandroidapp => sgbmdepthapp}/ui/Menu.kt (98%) rename app/src/main/java/me/timpushkin/{sgbmandroidapp => sgbmdepthapp}/ui/ResultsScreen.kt (96%) rename app/src/main/java/me/timpushkin/{sgbmandroidapp => sgbmdepthapp}/utils/Conversions.kt (96%) rename app/src/main/java/me/timpushkin/{sgbmandroidapp => sgbmdepthapp}/utils/StorageUtils.kt (96%) rename {sgbmandroid => sgbmdepth}/.gitignore (100%) rename {sgbmandroid => sgbmdepth}/build.gradle (96%) rename {sgbmandroid => sgbmdepth}/consumer-rules.pro (91%) rename {sgbmandroid => sgbmdepth}/proguard-rules.pro (100%) rename {sgbmandroid => sgbmdepth}/src/main/AndroidManifest.xml (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/.clang-tidy (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/.gitignore (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/BuildOpenCV.cmake (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/CMakeLists.txt (97%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/CPPLINT.cfg (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/README.md (99%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/examples/CMakeLists.txt (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/examples/GetDepthExample.cpp (94%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/examples/images/calib_params.xml (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/examples/images/clothes_l.png (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/examples/images/clothes_r.png (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/external/CMakeLists.txt (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/external/log-lib/CMakeLists.txt (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/external/opencv/CMakeLists.txt (100%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/include/DepthEstimator.h (93%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/src/CMakeLists.txt (90%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/src/Constants.h (76%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/src/Conversions.h (84%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/src/DepthEstimator.cpp (98%) rename {sgbmandroid => sgbmdepth}/src/main/cpp/src/Logging.h (94%) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 0be8a29..fceb767 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -3,7 +3,7 @@ name: Android on: [ push, workflow_dispatch ] env: - NATIVE_PROJECT_SUBDIR: sgbmandroid/src/main/cpp + NATIVE_PROJECT_SUBDIR: sgbmdepth/src/main/cpp BUILD_SUBDIR: build ABIS: "armeabi-v7a arm64-v8a x86 x86_64" TOOLCHAIN_SUBPATH: build/cmake/android.toolchain.cmake @@ -83,7 +83,7 @@ jobs: run: chmod +x gradlew - name: Build Android library - run: ./gradlew :sgbmandroid:build + run: ./gradlew :sgbmdepth:build - name: Build Android app run: ./gradlew :app:build diff --git a/.github/workflows/native.yml b/.github/workflows/native.yml index 93e5c14..42e7d13 100644 --- a/.github/workflows/native.yml +++ b/.github/workflows/native.yml @@ -4,13 +4,13 @@ on: [ push, workflow_dispatch ] env: BUILD_TYPE: Debug - PROJECT_SUBDIR: sgbmandroid/src/main/cpp + PROJECT_SUBDIR: sgbmdepth/src/main/cpp BUILD_SUBDIR: build defaults: run: shell: bash - working-directory: sgbmandroid/src/main/cpp # Must be the same as env.PROJECT_SUBDIR + working-directory: sgbmdepth/src/main/cpp # Must be the same as env.PROJECT_SUBDIR jobs: build: @@ -25,7 +25,7 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/${{env.PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}} - key: ${{runner.os}}-build-cache-v4 + key: ${{runner.os}}-build-cache - name: Prepare OpenCV run: cmake -P BuildOpenCV.cmake @@ -57,7 +57,7 @@ jobs: path: | ~/.cmodule ${{github.workspace}}/${{env.PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}} - key: ${{runner.os}}-build-cache-bridge-v2 + key: ${{runner.os}}-build-cache-bridge - name: Prepare OpenCV run: cmake -P BuildOpenCV.cmake @@ -81,7 +81,7 @@ jobs: uses: actions/cache@v3 with: path: ${{github.workspace}}/${{env.PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}} - key: ${{runner.os}}-build-cache-v4 + key: ${{runner.os}}-build-cache - name: Configure linters run: | diff --git a/README.md b/README.md index 627ee00..ae5b4ca 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SgbmAndroid +# SgbmDepth Android library for depth estimation based on [StereoSGBM](https://docs.opencv.org/4.5.5/d2/d85/classcv_1_1StereoSGBM.html) from OpenCV. @@ -21,23 +21,23 @@ Two options are available: 1. **(Recommended)** Run `BuildOpenCV.cmake` script which will download and build OpenCV automatically with the recommended optimizations. Read more about how to run the script in the - [native part's README](sgbmandroid/src/main/cpp/README.md). You have to run it once for every + [native part's README](sgbmdepth/src/main/cpp/README.md). You have to run it once for every Android ABI you plan to use. 2. Download and install the prebuilt [OpenCV Android SDK](https://opencv.org/releases). It may lack some possible optimizations. After OpenCV is installed build the project with Gradle -- the library is available in -`:sgbmandroid` module. It builds for all ABIs. +`:sgbmdepth` module. It builds for all ABIs. Currently, the library is automatically generated from its native implementation, so no documentation is available in the resulting code. To read the `DepthEstimator` documentation see -[its native header](sgbmandroid/src/main/cpp/include/DepthEstimator.h). +[its native header](sgbmdepth/src/main/cpp/include/DepthEstimator.h). ## Demo application An example application is available in `:app` module. It computes a depth map from a pair of images using the chosen calibration parameters and displays the resulting image also showing the time it took to compute. You can get a sample stereo pair and calibration parameters for it -[here](sgbmandroid/src/main/cpp/examples/images) to try it out and test the performance. +[here](sgbmdepth/src/main/cpp/examples/images) to try it out and test the performance. Demo application GUI diff --git a/app/build.gradle b/app/build.gradle index 51907d8..1ecc44b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,10 +7,10 @@ plugins { android { compileSdk 31 - namespace 'me.timpushkin.sgbmandroidapp' + namespace 'me.timpushkin.sgbmdepthapp' defaultConfig { - applicationId 'me.timpushkin.sgbmandroidapp' + applicationId 'me.timpushkin.sgbmdepthapp' minSdk 21 targetSdk 31 versionCode 1 @@ -57,7 +57,7 @@ dependencies { implementation 'com.squareup.okio:okio:3.1.0' implementation 'com.google.modernstorage:modernstorage-storage:1.0.0-alpha06' - implementation project(':sgbmandroid') + implementation project(':sgbmdepth') } ktlint { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index c06d129..796b7d0 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -7,9 +7,9 @@ android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" - android:theme="@style/Theme.SgbmAndroid"> + android:theme="@style/Theme.SgbmDepthApp"> diff --git a/app/src/main/java/me/timpushkin/sgbmandroidapp/MainActivity.kt b/app/src/main/java/me/timpushkin/sgbmdepthapp/MainActivity.kt similarity index 93% rename from app/src/main/java/me/timpushkin/sgbmandroidapp/MainActivity.kt rename to app/src/main/java/me/timpushkin/sgbmdepthapp/MainActivity.kt index 036fbff..0f23ff5 100644 --- a/app/src/main/java/me/timpushkin/sgbmandroidapp/MainActivity.kt +++ b/app/src/main/java/me/timpushkin/sgbmdepthapp/MainActivity.kt @@ -1,4 +1,4 @@ -package me.timpushkin.sgbmandroidapp +package me.timpushkin.sgbmdepthapp import android.graphics.Bitmap import android.net.Uri @@ -15,12 +15,12 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.asImageBitmap import kotlinx.coroutines.launch -import me.timpushkin.sgbmandroid.DepthEstimator -import me.timpushkin.sgbmandroidapp.ui.AppState -import me.timpushkin.sgbmandroidapp.ui.Menu -import me.timpushkin.sgbmandroidapp.ui.ResultsScreen -import me.timpushkin.sgbmandroidapp.utils.StorageUtils -import me.timpushkin.sgbmandroidapp.utils.depthArrayToBitmap +import me.timpushkin.sgbmdepth.DepthEstimator +import me.timpushkin.sgbmdepthapp.ui.AppState +import me.timpushkin.sgbmdepthapp.ui.Menu +import me.timpushkin.sgbmdepthapp.ui.ResultsScreen +import me.timpushkin.sgbmdepthapp.utils.StorageUtils +import me.timpushkin.sgbmdepthapp.utils.depthArrayToBitmap private const val CACHED_PARAMS = "params.xml" diff --git a/app/src/main/java/me/timpushkin/sgbmandroidapp/ui/AppState.kt b/app/src/main/java/me/timpushkin/sgbmdepthapp/ui/AppState.kt similarity index 85% rename from app/src/main/java/me/timpushkin/sgbmandroidapp/ui/AppState.kt rename to app/src/main/java/me/timpushkin/sgbmdepthapp/ui/AppState.kt index ec014c4..6ecb2b7 100644 --- a/app/src/main/java/me/timpushkin/sgbmandroidapp/ui/AppState.kt +++ b/app/src/main/java/me/timpushkin/sgbmdepthapp/ui/AppState.kt @@ -1,11 +1,11 @@ -package me.timpushkin.sgbmandroidapp.ui +package me.timpushkin.sgbmdepthapp.ui import android.graphics.Bitmap import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel -import me.timpushkin.sgbmandroid.DepthEstimator +import me.timpushkin.sgbmdepth.DepthEstimator class AppState : ViewModel() { var depthEstimator by mutableStateOf(null) diff --git a/app/src/main/java/me/timpushkin/sgbmandroidapp/ui/Menu.kt b/app/src/main/java/me/timpushkin/sgbmdepthapp/ui/Menu.kt similarity index 98% rename from app/src/main/java/me/timpushkin/sgbmandroidapp/ui/Menu.kt rename to app/src/main/java/me/timpushkin/sgbmdepthapp/ui/Menu.kt index 4b6969c..8700ba5 100644 --- a/app/src/main/java/me/timpushkin/sgbmandroidapp/ui/Menu.kt +++ b/app/src/main/java/me/timpushkin/sgbmdepthapp/ui/Menu.kt @@ -1,4 +1,4 @@ -package me.timpushkin.sgbmandroidapp.ui +package me.timpushkin.sgbmdepthapp.ui import android.net.Uri import android.webkit.MimeTypeMap diff --git a/app/src/main/java/me/timpushkin/sgbmandroidapp/ui/ResultsScreen.kt b/app/src/main/java/me/timpushkin/sgbmdepthapp/ui/ResultsScreen.kt similarity index 96% rename from app/src/main/java/me/timpushkin/sgbmandroidapp/ui/ResultsScreen.kt rename to app/src/main/java/me/timpushkin/sgbmdepthapp/ui/ResultsScreen.kt index d9fbf48..3ebd220 100644 --- a/app/src/main/java/me/timpushkin/sgbmandroidapp/ui/ResultsScreen.kt +++ b/app/src/main/java/me/timpushkin/sgbmdepthapp/ui/ResultsScreen.kt @@ -1,4 +1,4 @@ -package me.timpushkin.sgbmandroidapp.ui +package me.timpushkin.sgbmdepthapp.ui import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Arrangement diff --git a/app/src/main/java/me/timpushkin/sgbmandroidapp/utils/Conversions.kt b/app/src/main/java/me/timpushkin/sgbmdepthapp/utils/Conversions.kt similarity index 96% rename from app/src/main/java/me/timpushkin/sgbmandroidapp/utils/Conversions.kt rename to app/src/main/java/me/timpushkin/sgbmdepthapp/utils/Conversions.kt index 9121b5e..f9a320f 100644 --- a/app/src/main/java/me/timpushkin/sgbmandroidapp/utils/Conversions.kt +++ b/app/src/main/java/me/timpushkin/sgbmdepthapp/utils/Conversions.kt @@ -1,4 +1,4 @@ -package me.timpushkin.sgbmandroidapp.utils +package me.timpushkin.sgbmdepthapp.utils import android.graphics.Bitmap import android.util.Log diff --git a/app/src/main/java/me/timpushkin/sgbmandroidapp/utils/StorageUtils.kt b/app/src/main/java/me/timpushkin/sgbmdepthapp/utils/StorageUtils.kt similarity index 96% rename from app/src/main/java/me/timpushkin/sgbmandroidapp/utils/StorageUtils.kt rename to app/src/main/java/me/timpushkin/sgbmdepthapp/utils/StorageUtils.kt index 1521386..c0d0932 100644 --- a/app/src/main/java/me/timpushkin/sgbmandroidapp/utils/StorageUtils.kt +++ b/app/src/main/java/me/timpushkin/sgbmdepthapp/utils/StorageUtils.kt @@ -1,4 +1,4 @@ -package me.timpushkin.sgbmandroidapp.utils +package me.timpushkin.sgbmdepthapp.utils import android.content.Context import android.net.Uri diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7d6a4e0..6a1a2f0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - SgbmAndroid + SgbmDepth \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index e6d7b12..6dafdf8 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -1,5 +1,5 @@ -