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

Ocv instr test #364

Open
wants to merge 90 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
9e6a1bb
call native test method
vkocheryzhkin Apr 15, 2018
17566d2
Add custom detector
Apr 16, 2018
2191f3b
send bitmap to native
vkocheryzhkin Apr 17, 2018
73f2f2f
add dlib as submodule
vkocheryzhkin Apr 17, 2018
30b8869
link with dlib
vkocheryzhkin Apr 17, 2018
6bc6767
start conversion of bmp to rgb dlib image
vkocheryzhkin Apr 18, 2018
58cd257
basic dirty recognition
Apr 18, 2018
5205730
try to build release
Apr 18, 2018
e007fb9
play with rgb in native
Apr 19, 2018
2294feb
add basic python to get face vector
Apr 19, 2018
c1cca81
fix thresh for face rec
vkocheryzhkin Apr 19, 2018
5bc87c3
decrease threshold
vkocheryzhkin Apr 19, 2018
89d9677
restyle for demo
vkocheryzhkin Apr 19, 2018
95bf942
demo prepare #2
Apr 20, 2018
349fe5a
add identify button to use dlib from photo
vkocheryzhkin Apr 28, 2018
923e0b4
use separate sp and net
vkocheryzhkin Apr 28, 2018
86365a8
add basic instrumentation test
vkocheryzhkin May 4, 2018
29672e5
add travis
vkocheryzhkin May 8, 2018
3c295df
modify travis
vkocheryzhkin May 8, 2018
5d60921
update travis
vkocheryzhkin May 8, 2018
845d8ac
update travis
vkocheryzhkin May 8, 2018
6561285
update travis 4
vkocheryzhkin May 8, 2018
3f9e256
update travis 5
vkocheryzhkin May 8, 2018
c4684a3
remove abs path to signing
vkocheryzhkin May 8, 2018
831f491
update travis
vkocheryzhkin May 8, 2018
93ccda9
dup key for release
vkocheryzhkin May 8, 2018
d840398
disable lint temprarily
vkocheryzhkin May 8, 2018
2d43257
add simple native test
May 15, 2018
fb12260
start refactoring
vkocheryzhkin May 15, 2018
081986f
try to move all logic into FaceRecognizer
May 16, 2018
d37b412
try to read image from assets
vkocheryzhkin May 16, 2018
5530658
fix test
vkocheryzhkin May 16, 2018
1d2d322
refactor recognize methods
vkocheryzhkin May 18, 2018
a962582
try orientation with exif
vkocheryzhkin May 21, 2018
74faab8
rotate cropped bitmap
May 22, 2018
bb1078e
implement all orientations
vkocheryzhkin May 22, 2018
c4ca415
clean up
vkocheryzhkin May 22, 2018
e778aaf
delete exif
vkocheryzhkin May 22, 2018
f58b237
Merge pull request #1 from hoopoe/bitmap_orientation
vkocheryzhkin May 23, 2018
63f075a
This AS app is OpenCV and Dlib based configured as two different modu…
aloruss1 May 24, 2018
1153e58
build with opencv and dlib
vkocheryzhkin May 25, 2018
e49a4d8
remove opencv for java
vkocheryzhkin May 27, 2018
cf3db1e
remove jni libs
vkocheryzhkin May 27, 2018
8442d59
fix load dir
vkocheryzhkin May 27, 2018
b696585
merge master
vkocheryzhkin May 27, 2018
0da1b19
fix build
vkocheryzhkin May 27, 2018
8d299cb
fix local build for opencv
vkocheryzhkin May 27, 2018
df71024
Merge pull request #2 from hoopoe/AS-OpenCV-DLib-2modules
vkocheryzhkin May 27, 2018
5306431
restructure project
vkocheryzhkin May 27, 2018
a88b3c7
Update README.md
vkocheryzhkin May 27, 2018
ad52dfe
clean up
vkocheryzhkin May 28, 2018
1a593d6
disable identify button temporarly. try to fix build
vkocheryzhkin May 28, 2018
cd61e96
fix build
vkocheryzhkin May 28, 2018
2906463
enable auto focus
vkocheryzhkin May 30, 2018
d044290
update readme for rt statement
vkocheryzhkin May 30, 2018
3dcab26
update readme
vkocheryzhkin May 31, 2018
9701c10
request permissions for camera and sdcard together
vkocheryzhkin Jun 1, 2018
6bb8264
get cam resolution
vkocheryzhkin Jun 2, 2018
0142554
try to fix permission issue
vkocheryzhkin Jun 2, 2018
b0a9375
add Spc detector
sweetdream779 Jun 3, 2018
36ca54d
add Spc detector
sweetdream779 Jun 3, 2018
dc5a8f1
fix initial portrait orientation
vkocheryzhkin Jun 3, 2018
c7e7768
Merge pull request #3 from hoopoe/permissions
vkocheryzhkin Jun 4, 2018
cb6d7af
refactor to use 2 activities
vkocheryzhkin Jun 4, 2018
d609727
change readme; change build gradle
sweetdream779 Jun 4, 2018
9e4d3ad
change readme
sweetdream779 Jun 4, 2018
43e6d4b
Merge pull request #4 from hoopoe/activity
vkocheryzhkin Jun 5, 2018
6277ec9
merge projects
sweetdream779 Jun 6, 2018
b68dba6
merge projects
sweetdream779 Jun 6, 2018
7c1ba3d
remove .externalNativeBuild
sweetdream779 Jun 7, 2018
6b8416d
get tensorflow before build
vkocheryzhkin Jun 7, 2018
7624cfc
update travis
vkocheryzhkin Jun 7, 2018
e606a10
Merge pull request #6 from hoopoe/activity
vkocheryzhkin Jun 7, 2018
867dbf5
Merge branch 'master' into dlib-opencv-tf
vkocheryzhkin Jun 8, 2018
4e73909
change readme; add OPENCV_ANDROID_SDK var in CMakeLists
sweetdream779 Jun 8, 2018
3245ee7
Merge branch 'dlib-opencv-tf' of https://github.com/sweetdream779/FR-…
sweetdream779 Jun 8, 2018
f9a876c
Update README.md
sweetdream779 Jun 8, 2018
d211a05
Update README.md
sweetdream779 Jun 8, 2018
18edb6f
change paths; updates readme
sweetdream779 Jun 8, 2018
555ec04
change paths; updates readme
sweetdream779 Jun 8, 2018
a259d1e
return $ENV{OPENCV_ANDROID_SDK}
sweetdream779 Jun 8, 2018
f6d82fb
dlib as submodule
sweetdream779 Jun 8, 2018
60e3c66
change abiFilters
sweetdream779 Jun 8, 2018
359b090
del dlib
sweetdream779 Jun 9, 2018
01348d4
add submodule
sweetdream779 Jun 9, 2018
f3be575
Merge pull request #5 from sweetdream779/dlib-opencv-tf
vkocheryzhkin Jun 13, 2018
a5fcd0e
clean up. reorder activities
vkocheryzhkin Jun 14, 2018
6ba4f0c
merge of tensorflow and OpenCV with google-vision Dlib
aloruss1 Jun 19, 2018
0544881
added lint options for OpenCV and excluded .externalNativeBuild folde…
aloruss1 Jun 19, 2018
a48ff43
.externalNativeBuild deletion
aloruss1 Jun 19, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ build/
local.properties
.DS_Store
captures/
*.a
*.so
FaceTracker/app/.externalNativeBuild/
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "dlib"]
path = dlib
url = git://github.com/hoopoe/dlib.git
branch = android
49 changes: 0 additions & 49 deletions .google/packaging.yaml

This file was deleted.

48 changes: 48 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
language: android
jdk:
- oraclejdk8
branches:
only:
- master
env:
global:
- ANDROID_TARGET=android-23
- ANDROID_ABI=armeabi-v7a

before_install:
- mkdir -p $ANDROID_HOME/licenses
- echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > $ANDROID_HOME/licenses/android-sdk-license
- echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> $ANDROID_HOME/licenses/android-sdk-license
install:
- echo y | sdkmanager "ndk-bundle"
- echo y | sdkmanager "cmake;3.6.4111459"
- echo y | sdkmanager "lldb;3.1"

android:
components:
- tools
- platform-tools
- build-tools-27.0.3
- android-23
- extra-android-m2repository
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}

licenses:
- android-sdk-preview-license-.+
- android-sdk-license-.+
- google-gdk-license-.+

before_install:
- echo $(ant -version)

before_script:
- wget https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip
- unzip -q opencv-3.4.1-android-sdk.zip
- export OPENCV_ANDROID_SDK=$(pwd)/OpenCV-android-sdk
- git clone https://github.com/tensorflow/tensorflow.git
- export TF_SRC_ROOT=$(pwd)/tensorflow

script:
- cd FaceTracker
- ./gradlew build

File renamed without changes.
File renamed without changes.
87 changes: 87 additions & 0 deletions FaceTracker/app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Sets the minimum version of CMake required to build the native
# library. You should either keep the default value or only pass a
# value of 3.4.0 or lower.

cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_VERBOSE_MAKEFILE on)
set (CMAKE_CXX_STANDARD 11)

include_directories($ENV{OPENCV_ANDROID_SDK}/sdk/native/jni/include)
add_library( lib_opencv SHARED IMPORTED )
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION $ENV{OPENCV_ANDROID_SDK}/sdk/native/libs/${ANDROID_ABI}/libopencv_java3.so)

find_library( # Sets the name of the path variable.
log-lib

# Specifies the name of the NDK library that
# you want CMake to locate.
log )

set(DLIB_DIR ../../dlib)
include_directories(${DLIB_DIR})
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

add_library( # Sets the name of the library.
lib_dlib

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
../../dlib/dlib/threads/threads_kernel_shared.cpp
../../dlib/dlib/entropy_decoder/entropy_decoder_kernel_2.cpp
../../dlib/dlib/base64/base64_kernel_1.cpp
../../dlib/dlib/threads/threads_kernel_1.cpp
../../dlib/dlib/threads/threads_kernel_2.cpp
../../dlib/dlib/threads/thread_pool_extension.cpp
../../dlib/dlib/threads/async.cpp
../../dlib/dlib/dnn/cpu_dlib.cpp
../../dlib/dlib/dnn/tensor_tools.cpp
)

add_library( # Sets the name of the library.
native-lib

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
src/main/cpp/native-lib.cpp )

target_link_libraries( # Specifies the target library.
native-lib

lib_dlib

-ljnigraphics

# Links the target library to the log library
# included in the NDK.
${log-lib} )



add_library( # Sets the name of the library.
OCV-native-lib

# Sets the library as a shared library.
SHARED

# Provides a relative path to your source file(s).
# Associated headers in the same location as their source
# file are automatically included.
src/main/cpp/OCV-native-lib.cpp )

target_link_libraries(
OCV-native-lib

lib_opencv

${log-lib} )

add_subdirectory("./jni")
99 changes: 99 additions & 0 deletions FaceTracker/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
apply plugin: 'com.android.application'
// Output directory in the local directory for packaging into the APK.

android {
signingConfigs {
config {
keyAlias 'test'
keyPassword 'test123321'
storeFile file('signing/test.jks')
storePassword 'test123321'
}
}
compileSdkVersion 23
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.google.android.gms.samples.vision.face.facetracker"
minSdkVersion 15 // AL 21 ==> 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
externalNativeBuild {
cmake {
cppFlags "-frtti -fexceptions -std=c++11"
abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
arguments "-DANDROID_STL=gnustl_shared"
}
}
signingConfig signingConfigs.config


// Specifies the application ID for the test APK.
testApplicationId "org.opencv.android.facetracker"
// Specifies the fully-qualified class name of the test instrumentation runner.
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

// sourceSets { // AL: added
// main {
// jniLibs.srcDirs = ['src/main/jniLibs']
// jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/']
// //jni.srcDirs = []
// }
// }

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
}

externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}

testBuildType "release"
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
productFlavors {
}
lintOptions {
abortOnError false
}

sourceSets {main {jniLibs.srcDirs=['src/main/jni', 'src/main/jniLibs/'] }
androidTest { // AL (
java.srcDir file('src/androidTest/java')
resources.srcDir file('src/androidTest/assets')
} // AL )
}

configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.4.0'
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation 'junit:junit:4.12'
implementation 'com.android.support:support-annotations:27.1.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:support-v4:23.4.0'
implementation 'com.android.support:design:23.4.0'
implementation 'com.google.android.gms:play-services-vision:9.4.0+'
implementation 'com.shamanland:xdroid-toaster:0.2.4'
implementation 'org.tensorflow:tensorflow-android:+'
implementation project(':openCVLibrary330')
}
56 changes: 56 additions & 0 deletions FaceTracker/app/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
project(TENSORFLOW_DETECTOR)
cmake_minimum_required(VERSION 3.4.1)

set(CMAKE_VERBOSE_MAKEFILE on)

get_filename_component(SAMPLE_SRC_DIR ${CMAKE_SOURCE_DIR}/ ABSOLUTE)

if (ANDROID_ABI MATCHES "^armeabi-v7a$")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp -mfpu=neon")
elseif(ANDROID_ABI MATCHES "^arm64-v8a")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -ftree-vectorize")
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTANDALONE_DEMO_LIB \
-std=c++11 -fno-exceptions -fno-rtti -O2 -Wno-narrowing \
-fPIE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \
-Wl,--allow-multiple-definition \
-Wl,--whole-archive -fPIE -v")

file(GLOB_RECURSE tensorflow_detector_sources ${SAMPLE_SRC_DIR}/jni/*.*)

find_library( # Sets the name of the path variable.
log-lib

# Specifies the name of the NDK library that
# you want CMake to locate.
log )

add_library(tensorflow_detector SHARED
${tensorflow_detector_sources})
target_include_directories(tensorflow_detector PRIVATE
${CMAKE_SOURCE_DIR})

target_link_libraries(tensorflow_detector
android
log
jnigraphics
m
atomic
z)
Empty file added FaceTracker/app/jni/__init__.py
Empty file.
Loading