Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished implementation #9

Merged
merged 98 commits into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
db9c257
Add DepthEstimator
TimPushkin Mar 23, 2022
5ff24f5
Add constructor for DepthEstimator
TimPushkin Mar 23, 2022
c2456a7
Add public methods with std types to DepthEstimator
TimPushkin Mar 24, 2022
96d741f
Add core library usage example
TimPushkin Mar 24, 2022
c9cb222
Refactor project structure
TimPushkin Mar 25, 2022
2f4ee2d
Fix examples building
TimPushkin Mar 25, 2022
58b7338
Fix encoded and decoded images mixed up in depth calculation
TimPushkin Mar 25, 2022
18f62c0
Make core library example more understandable
TimPushkin Apr 10, 2022
5ac12c7
Move unnecessary libraries out of PUBLIC linkage
TimPushkin Apr 10, 2022
92ad157
Remove bare-OpenCV methods from DepthEstimator
TimPushkin Apr 10, 2022
0718ee6
Remove some constants from DepthEstimator
TimPushkin Apr 10, 2022
51e8ea1
Move temporary calibration into DepthEstimator constructor
TimPushkin Apr 13, 2022
d75fa91
Implement non-Android logging
TimPushkin Apr 13, 2022
bc57d1a
Remove CalibParamsReader
TimPushkin Apr 13, 2022
147b800
Fix codestyle
TimPushkin Apr 13, 2022
9c32f77
Add cpp subdirectory .gitignore
TimPushkin Apr 15, 2022
8717b7b
Fix some clang-tidy readability warnings
TimPushkin Apr 15, 2022
9f937bd
Add workflow for native code
TimPushkin Apr 15, 2022
e494804
Fix clang-tidy in CI
TimPushkin Apr 16, 2022
53e6515
Use ccache in native build
TimPushkin Apr 16, 2022
501829b
Use ccache in native workflow
TimPushkin Apr 16, 2022
4ac345a
Treat some warnings as errors in clang-tidy
TimPushkin Apr 16, 2022
c526485
Move linting to a separate jobin native workflow
TimPushkin Apr 16, 2022
dab85e6
Set verbose CMake output in native workflow
TimPushkin Apr 16, 2022
1ee32e8
Fix CLI args error message in GetDepthExample
TimPushkin Apr 16, 2022
50ea8d5
Remove verbose CMake output in native workflow
TimPushkin Apr 16, 2022
0423b02
Use ccache from ccache-action
TimPushkin Apr 16, 2022
f8bd484
Merge pull request #4 from TimPushkin/ci
TimPushkin Apr 17, 2022
a996b1b
Add Android library files
TimPushkin Apr 19, 2022
2823d38
Fix native logging on Android
TimPushkin Apr 20, 2022
ea9a1c7
Set up OpenCV configuration for Android
TimPushkin Apr 20, 2022
f7d286f
Add global namespace to public native code
TimPushkin Apr 21, 2022
23def30
Configure javacpp for JNI interface generation
TimPushkin Apr 21, 2022
371897b
Move java files generated by javacpp to build directory
TimPushkin Apr 21, 2022
78dc564
Fix deprecations in gradle javacpp configuration
TimPushkin Apr 21, 2022
d1960ac
Add generated native javacpp files to gitignore
TimPushkin Apr 21, 2022
def88af
Use globbing in native build
TimPushkin Apr 21, 2022
8782fa7
Add app
TimPushkin Apr 22, 2022
0c52691
Change app to pass calib file path to lib
TimPushkin Apr 22, 2022
c8e2cf2
Fix applicationId
TimPushkin Apr 22, 2022
f5eee6d
Fix native library loading
TimPushkin Apr 22, 2022
3295b82
Justify ninja usage
TimPushkin Apr 24, 2022
a8f656d
Update native code README
TimPushkin Apr 24, 2022
6ea7e62
Subdivide CMake project
TimPushkin Apr 25, 2022
dc3c2f6
Add workflow for Android
TimPushkin Apr 25, 2022
d1a18e5
Remove compiling restrictions from native CI
TimPushkin Apr 25, 2022
f078392
Update build cache in native CI
TimPushkin Apr 25, 2022
6c74949
Improve app code style
TimPushkin Apr 28, 2022
62e9095
Add ktlint to Android CI
TimPushkin Apr 28, 2022
d1fb099
Try to replace javacpp with Scapix
TimPushkin Apr 28, 2022
0f5cc2e
Dirty example on building scapix bridge for app
anastasiia-kornilova May 4, 2022
9739a6e
Clean Scapix-configuration-related code
TimPushkin May 5, 2022
0831651
Temporarily fix Scapix conflicting with examples CMake target
TimPushkin May 5, 2022
8cea867
Fix native flags and arguments
TimPushkin May 5, 2022
8a2f6cc
Change workflows to account for Scapix
TimPushkin May 5, 2022
c3dbcb8
Cache the whole build dir for native linting
TimPushkin May 6, 2022
536d854
Cache cmodule in CI
TimPushkin May 6, 2022
eedcf8a
Fix Android app building in CI
TimPushkin May 6, 2022
c97c55e
Ignore DepthEstimator::calibrate in clang-tidy
TimPushkin May 6, 2022
9471465
Fix logging for Android in native code
TimPushkin May 6, 2022
a026209
Remember state in demo app
TimPushkin May 7, 2022
c506b5e
Center depthmap in demo app
TimPushkin May 7, 2022
75cde00
Remove magic constants from native code
TimPushkin May 7, 2022
b1b2dd3
Fix NOLINT conflict
TimPushkin May 7, 2022
6b45a9b
Fix int-float conversions
TimPushkin May 7, 2022
ee648b6
Reuse a single instance of StereoSGBM
TimPushkin May 7, 2022
f978ce5
Download OpenCV by URL instead of git
TimPushkin May 8, 2022
4f984d4
Return 2D array from `estimateDepth`
TimPushkin May 10, 2022
b249727
Fix disparity map correction
TimPushkin May 12, 2022
3ce2d4d
Implement external OpenCV build script
TimPushkin May 13, 2022
9e2dc6b
Add building instructions
TimPushkin May 13, 2022
3dd92a8
Remove redundant code from BuildOpenCV
TimPushkin May 13, 2022
8239846
Add suffixes support to BuildOpenCV
TimPushkin May 14, 2022
7fc62e7
Update Gradle and dependencies
TimPushkin May 14, 2022
96d6bba
Add OpenCV building to CI
TimPushkin May 15, 2022
99f612a
Add option to patch OpenCV config finding procedure in BuildOpenCV
TimPushkin May 16, 2022
fa52c71
Add depth calculation time measurement to app
TimPushkin May 16, 2022
ccce7e9
Prepare release build
TimPushkin May 16, 2022
9dc499e
Add Run button in app
TimPushkin May 17, 2022
a8a39de
Add scale factor setting to app
TimPushkin May 17, 2022
27bd60a
Split long CMake calls in workflows
TimPushkin May 18, 2022
d5b3216
Move depth estimation consts into a separate header
TimPushkin May 18, 2022
97681a2
Remove `calibrate` from `DepthEstimator`
TimPushkin May 18, 2022
907a3c4
Fix define style in consts header
TimPushkin May 18, 2022
41b7e1d
Make cpplint run quietly in CI
TimPushkin May 18, 2022
29f15da
Put Android lib and app building into a single job
TimPushkin May 19, 2022
b03d6b3
Use ViewModel instead of caching in app
TimPushkin May 19, 2022
e27a202
Add Q scaling
TimPushkin May 19, 2022
09c0308
Fix scale factor saving
TimPushkin May 19, 2022
52e2e91
Add max disparity scaling
TimPushkin May 20, 2022
4ec8255
Create LICENSE
TimPushkin May 20, 2022
690c1d1
Add documentation in app
TimPushkin May 21, 2022
4c2ead0
Add DepthEstimator documentation
TimPushkin May 21, 2022
babf38f
Add main README
TimPushkin May 21, 2022
55f966d
Rename project
TimPushkin May 21, 2022
a079951
Fix multiline CMake calls in native workflow
TimPushkin May 21, 2022
31f0fea
Clear native build cache
TimPushkin May 21, 2022
21e5949
Change library name in main README
TimPushkin May 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*.{kt,kts}]
indent_size = 4
insert_final_newline = true
disabled_rules = no-wildcard-imports
89 changes: 89 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Android

on: [ push, workflow_dispatch ]

env:
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
C_COMPILER_SUBPATH: toolchains/llvm/prebuilt/linux-x86_64/bin/clang
CXX_COMPILER_SUBPATH: toolchains/llvm/prebuilt/linux-x86_64/bin/clang++

defaults:
run:
shell: bash

jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Run ktlint
run: ./gradlew ktlintCheck

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'

- uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r23b
add-to-path: false

- name: Cache native-build-related files
uses: actions/cache@v3
with:
path: |
~/.cmodule
${{github.workspace}}/${{env.NATIVE_PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}}
key: ${{runner.os}}-native-build-cache

- name: Prepare OpenCV
env:
NDK: ${{steps.setup-ndk.outputs.ndk-path}}
working-directory: ${{env.NATIVE_PROJECT_SUBDIR}}
run: |
for ABI in $ABIS; do
if [ ! -f "${{env.BUILD_SUBDIR}}/opencv-build-$ABI/OpenCVConfig.cmake" ]; then
echo "Preparing OpenCV for $ABI"
cmake -D CMAKE_TOOLCHAIN_FILE="$NDK/$TOOLCHAIN_SUBPATH" \
-D CMAKE_C_COMPILER="$NDK/$C_COMPILER_SUBPATH" \
-D CMAKE_CXX_COMPILER="$NDK/$CXX_COMPILER_SUBPATH" \
-D ANDROID_ABI=$ABI \
-D BUILD_DIR_SUFFIX=$ABI \
-D ADD_ANDROID_ABI_CHECK=ON \
-P BuildOpenCV.cmake
else
echo "OpenCV for $ABI already prepared"
fi
done

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build Android library
run: ./gradlew :sgbmdepth:build

- name: Build Android app
run: ./gradlew :app:build
97 changes: 97 additions & 0 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Native

on: [ push, workflow_dispatch ]

env:
BUILD_TYPE: Debug
PROJECT_SUBDIR: sgbmdepth/src/main/cpp
BUILD_SUBDIR: build

defaults:
run:
shell: bash
working-directory: sgbmdepth/src/main/cpp # Must be the same as env.PROJECT_SUBDIR

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: hendrikmuhs/[email protected]

- name: Cache build artifacts
uses: actions/cache@v3
with:
path: ${{github.workspace}}/${{env.PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}}
key: ${{runner.os}}-build-cache-v5

- name: Prepare OpenCV
run: cmake -P BuildOpenCV.cmake

- name: Configure CMake
run: |
cmake -B ${{env.BUILD_SUBDIR}} \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D CMAKE_EXPORT_COMPILE_COMMANDS=ON \
-D BUILD_EXAMPLES=ON

- name: Build
run: cmake --build ${{env.BUILD_SUBDIR}} --config ${{env.BUILD_TYPE}}

build-java-bridge:
runs-on: ubuntu-latest

env:
CC: clang
CXX: clang++

steps:
- uses: actions/checkout@v3

- uses: hendrikmuhs/[email protected]

- name: Cache build artifacts
uses: actions/cache@v3
with:
path: |
~/.cmodule
${{github.workspace}}/${{env.PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}}
key: ${{runner.os}}-build-cache-bridge

- name: Prepare OpenCV
run: cmake -P BuildOpenCV.cmake

- name: Configure CMake
run: |
cmake -B ${{env.BUILD_SUBDIR}} \
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
-D SCAPIX_BRIDGE=java

- name: Build
run: cmake --build ${{env.BUILD_SUBDIR}} --config ${{env.BUILD_TYPE}}

lint:
needs: build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache build artifacts
uses: actions/cache@v3
with:
path: ${{github.workspace}}/${{env.PROJECT_SUBDIR}}/${{env.BUILD_SUBDIR}}
key: ${{runner.os}}-build-cache-v5

- name: Configure linters
run: |
pip install cpplint
sudo apt-get install clang-tidy

- name: Run cpplint
run: cpplint --recursive --quiet .

- name: Run clang-tidy
run: run-clang-tidy -p ${{env.BUILD_SUBDIR}}
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*.iml
.gradle
/local.properties
.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
Loading