forked from Akylas/OSS-DocumentScanner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: full rewrite of the app using C++
- Loading branch information
1 parent
cfbaa14
commit 70bde77
Showing
160 changed files
with
4,763 additions
and
6,705 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ e2e/**/*.js | |
/fastlane/report.xml | ||
/gpx | ||
/dist | ||
build | ||
/Gemfile.lock | ||
firmware | ||
firmwares | ||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
ext { | ||
compileSdk = 32 | ||
targetSdk = 32 | ||
buildToolsVersion = "33.0.0" | ||
androidxVersion = "1.8.0" | ||
androidXAppCompat = "1.3.1" | ||
androidXAppCompatVersion = "1.3.1" | ||
androidXFragment = "1.4.1" | ||
compileSdk = 34 | ||
targetSdk = 34 | ||
androidBuildToolsVersion = "7.3.0" | ||
buildToolsVersion = "33.0.1" | ||
androidxVersion = "1.12.0" | ||
androidXAppCompat = "1.6.1" | ||
androidXAppCompatVersion = "1.6.1" | ||
androidXFragment = "1.6.1" | ||
androidXTransition = "1.4.1" | ||
androidXRecyclerViewVersion = "1.2.1" | ||
androidXSwipeRefreshLayoutViewVersion = "1.1.0" | ||
androidXMaterial = "1.6.1" | ||
androidXBrowser = "1.4.0" | ||
androidXRecyclerViewVersion = "1.3.1" | ||
androidxViewPager2Version = "1.1.0-beta02" | ||
androidXSwipeRefreshLayoutViewVersion = "1.2.0-alpha01" | ||
androidXMaterial = "1.9.0" | ||
androidXBrowser = "1.6.0" | ||
androidXPreferenceVersion = "1.2.1" | ||
okHttpVersion = "4.10.0" | ||
frescoVersion = "3.1.0" | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
NS_DEFAULT_ANDROID_BUILD_TOOLS_VERSION=7.2.1 | ||
# ns_default_kotlin_version=1.7.10 | ||
android.enableJetifier=false | ||
android.enableR8.fullMode=true | ||
android.experimental.enableNewResourceShrinker.preciseShrinking=true | ||
org.gradle.jvmargs=-XX:+UseParallelGC | ||
useKotlin=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/home/mguillon/dev/android/android-document-scanner/documentscanner/opencv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# For more information about using CMake with Android Studio, read the | ||
# documentation: https://d.android.com/studio/projects/add-native-code.html | ||
|
||
# Sets the minimum version of CMake required to build the native library. | ||
|
||
cmake_minimum_required(VERSION 3.4.1) | ||
|
||
set(TARGET document_detector) | ||
set(SRC_DIR ./) | ||
set(SRC_DIR2 ./src) | ||
set(OPENCV_LIB_DIR opencv/staticlibs/${ANDROID_ABI}/) | ||
set(OPENCV_3RD_LIB_DIR opencv/3rdparty/libs/${ANDROID_ABI}/) | ||
|
||
include_directories(opencv/include | ||
./include) | ||
|
||
|
||
link_directories(${OPENCV_LIB_DIR} | ||
${OPENCV_3RD_LIB_DIR}) | ||
|
||
|
||
# Creates and names a library, sets it as either STATIC | ||
# or SHARED, and provides the relative paths to its source code. | ||
# You can define multiple libraries, and CMake builds them for you. | ||
# Gradle automatically packages shared libraries with your APK. | ||
|
||
aux_source_directory(${SRC_DIR} DIR_LIB_SOURCE) | ||
aux_source_directory(${SRC_DIR2} DIR_LIB_SOURCE2) | ||
|
||
add_library(${TARGET} SHARED ${DIR_LIB_SOURCE} ${DIR_LIB_SOURCE2}) | ||
|
||
# Searches for a specified prebuilt library and stores the path as a | ||
# variable. Because CMake includes system libraries in the search path by | ||
# default, you only need to specify the name of the public NDK library | ||
# you want to add. CMake verifies that the library exists before | ||
# completing its build. | ||
|
||
target_link_libraries(${TARGET} log jnigraphics z dl m) | ||
|
||
# Specifies libraries CMake should link to your target library. You | ||
# can link multiple libraries, such as libraries you define in this | ||
# build script, prebuilt third-party libraries, or system libraries. | ||
|
||
if(${ANDROID_ABI} STREQUAL x86_64) | ||
target_link_libraries(${TARGET} opencv_imgproc opencv_core cpufeatures libprotobuf ade tbb ittnotify libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc) | ||
elseif(${ANDROID_ABI} STREQUAL x86) | ||
target_link_libraries(${TARGET} opencv_imgproc opencv_core cpufeatures libprotobuf ade tbb ittnotify libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc ippiw ippicv) | ||
else() | ||
target_link_libraries(${TARGET} opencv_imgproc opencv_core cpufeatures libprotobuf ade tbb ittnotify libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc tegra_hal) | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#include "android_utils.h" | ||
|
||
void bitmap_to_mat(JNIEnv *env, jobject &srcBitmap, Mat &srcMat) { | ||
void *srcPixels = 0; | ||
AndroidBitmapInfo srcBitmapInfo; | ||
try { | ||
AndroidBitmap_getInfo(env, srcBitmap, &srcBitmapInfo); | ||
AndroidBitmap_lockPixels(env, srcBitmap, &srcPixels); | ||
uint32_t srcHeight = srcBitmapInfo.height; | ||
uint32_t srcWidth = srcBitmapInfo.width; | ||
srcMat.create(srcHeight, srcWidth, CV_8UC4); | ||
if (srcBitmapInfo.format == ANDROID_BITMAP_FORMAT_RGBA_8888) { | ||
Mat tmp(srcHeight, srcWidth, CV_8UC4, srcPixels); | ||
tmp.copyTo(srcMat); | ||
} else { | ||
Mat tmp = Mat(srcHeight, srcWidth, CV_8UC2, srcPixels); | ||
cvtColor(tmp, srcMat, COLOR_BGR5652RGBA); | ||
} | ||
AndroidBitmap_unlockPixels(env, srcBitmap); | ||
return; | ||
} catch (cv::Exception &e) { | ||
AndroidBitmap_unlockPixels(env, srcBitmap); | ||
jclass je = env->FindClass("java/lang/Exception"); | ||
env -> ThrowNew(je, e.what()); | ||
return; | ||
} catch (...) { | ||
AndroidBitmap_unlockPixels(env, srcBitmap); | ||
jclass je = env->FindClass("java/lang/Exception"); | ||
env -> ThrowNew(je, "unknown"); | ||
return; | ||
} | ||
} | ||
|
||
void mat_to_bitmap(JNIEnv *env, Mat &srcMat, jobject &dstBitmap) { | ||
void *dstPixels = 0; | ||
AndroidBitmapInfo dstBitmapInfo; | ||
try { | ||
AndroidBitmap_getInfo(env, dstBitmap, &dstBitmapInfo); | ||
AndroidBitmap_lockPixels(env, dstBitmap, &dstPixels); | ||
uint32_t dstHeight = dstBitmapInfo.height; | ||
uint32_t dstWidth = dstBitmapInfo.width; | ||
if (dstBitmapInfo.format == ANDROID_BITMAP_FORMAT_RGBA_8888) { | ||
Mat tmp(dstHeight, dstWidth, CV_8UC4, dstPixels); | ||
if(srcMat.type() == CV_8UC1) { | ||
cvtColor(srcMat, tmp, COLOR_GRAY2RGBA); | ||
} else if (srcMat.type() == CV_8UC3) { | ||
cvtColor(srcMat, tmp, COLOR_RGB2RGBA); | ||
} else if (srcMat.type() == CV_8UC4) { | ||
srcMat.copyTo(tmp); | ||
} | ||
} else { | ||
Mat tmp = Mat(dstHeight, dstWidth, CV_8UC2, dstPixels); | ||
if(srcMat.type() == CV_8UC1) { | ||
cvtColor(srcMat, tmp, COLOR_GRAY2BGR565); | ||
} else if (srcMat.type() == CV_8UC3) { | ||
cvtColor(srcMat, tmp, COLOR_RGB2BGR565); | ||
} else if (srcMat.type() == CV_8UC4) { | ||
cvtColor(srcMat, tmp, COLOR_RGBA2BGR565); | ||
} | ||
} | ||
AndroidBitmap_unlockPixels(env, dstBitmap); | ||
}catch (cv::Exception &e) { | ||
AndroidBitmap_unlockPixels(env, dstBitmap); | ||
jclass je = env->FindClass("java/lang/Exception"); | ||
env -> ThrowNew(je, e.what()); | ||
return; | ||
} catch (...) { | ||
AndroidBitmap_unlockPixels(env, dstBitmap); | ||
jclass je = env->FindClass("java/lang/Exception"); | ||
env -> ThrowNew(je, "unknown"); | ||
return; | ||
} | ||
} | ||
|
||
|
||
|
Oops, something went wrong.