Skip to content

Commit

Permalink
update OpenCv to v4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pqpo committed Jul 3, 2019
1 parent 5ece8ca commit 1d73155
Show file tree
Hide file tree
Showing 332 changed files with 93,987 additions and 16,738 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "me.pqpo.smartcropper"
minSdkVersion 14
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.1"
ndk {
abiFilters 'armeabi-v7a', "arm64-v8a", 'x86'
abiFilters 'armeabi-v7a', "arm64-v8a", 'x86', 'x86_64'
}
}
buildTypes {
Expand Down
54 changes: 13 additions & 41 deletions smartcropperlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,27 @@

cmake_minimum_required(VERSION 3.4.1)

set(TARGET smart_cropper)
set(SRC_DIR src/main/cpp/)
set(OPENCV_LIB_DIR opencv/lib/${ANDROID_ABI}/)
set(OPENCV_3RD_LIB_DIR opencv/3rdparty/${ANDROID_ABI}/)

include_directories(opencv/include
src/main/cpp/include)

add_library(opencv_imgproc STATIC IMPORTED)
add_library(opencv_core STATIC IMPORTED)
if(EXISTS ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
add_library(tbb STATIC IMPORTED)
endif()

set_target_properties(opencv_imgproc PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libopencv_imgproc.a)
set_target_properties(opencv_core PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libopencv_core.a)
if(EXISTS ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
set_target_properties(tbb PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
endif()
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.

add_library( # Sets the name of the library.
smart_cropper

# Sets the library as a shared library.
SHARED
aux_source_directory(${SRC_DIR} DIR_LIB_SOURCE)

# Provides a relative path to your source file(s).
src/main/cpp/Scanner.cpp
src/main/cpp/smart_cropper.cpp
src/main/cpp/android_utils.cpp)
add_library(${TARGET} SHARED ${DIR_LIB_SOURCE})

# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
Expand All @@ -58,25 +48,7 @@ find_library(jnigraphics-lib
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

if(EXISTS ${PROJECT_SOURCE_DIR}/opencv/lib/${ANDROID_ABI}/libtbb.a)
target_link_libraries( # Specifies the target library.
smart_cropper
opencv_imgproc
opencv_core
tbb

# Links the target library to the log library
# included in the NDK.
${log-lib}
${jnigraphics-lib})
else()
target_link_libraries( # Specifies the target library.
smart_cropper
opencv_imgproc
opencv_core

# Links the target library to the log library
# included in the NDK.
${log-lib}
${jnigraphics-lib})
endif()
file(GLOB OPENCV_LIB_SOURCE "${OPENCV_LIB_DIR}/lib*.a")
file(GLOB OPENCV_3RD_LIB_SOURCE "${OPENCV_3RD_LIB_DIR}/lib*.a")

target_link_libraries(${TARGET} opencv_imgproc opencv_core tegra_hal tbb cpufeatures ${log-lib} ${jnigraphics-lib})
9 changes: 4 additions & 5 deletions smartcropperlib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ android {
compileSdkVersion 28

defaultConfig {
minSdkVersion 14
minSdkVersion 21
targetSdkVersion 28
versionCode 9
versionName "1.2.5"
versionName "2.0.0"

externalNativeBuild {
cmake {
cppFlags "-std=c++11 -frtti -fexceptions -lz"
abiFilters 'armeabi-v7a', "arm64-v8a", 'x86'
arguments '-DANDROID_STL=gnustl_shared'
abiFilters 'armeabi-v7a', "arm64-v8a", 'x86', 'x86_64'
}
}

Expand All @@ -38,5 +37,5 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly'
implementation 'org.tensorflow:tensorflow-lite:1.13.1'
}
Loading

0 comments on commit 1d73155

Please sign in to comment.