Skip to content

Commit db00bb9

Browse files
committed
solved some conflicts on gradle and OpenCvActivity.java
2 parents 7d14e41 + a5fcd0e commit db00bb9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+12732
-108
lines changed

Diff for: .gitmodules

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "dlib"]
22
path = dlib
3-
url = https://github.com/hoopoe/dlib.git
4-
branch = android
3+
url = git://github.com/hoopoe/dlib.git
4+
branch = android

Diff for: .travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ android:
2626
- android-23
2727
- extra-android-m2repository
2828
- sys-img-${ANDROID_ABI}-${ANDROID_TARGET}
29+
30+
licenses:
31+
- android-sdk-preview-license-.+
32+
- android-sdk-license-.+
33+
- google-gdk-license-.+
2934

3035
before_install:
3136
- echo $(ant -version)
@@ -34,6 +39,8 @@ before_script:
3439
- wget https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip
3540
- unzip -q opencv-3.4.1-android-sdk.zip
3641
- export OPENCV_ANDROID_SDK=$(pwd)/OpenCV-android-sdk
42+
- git clone https://github.com/tensorflow/tensorflow.git
43+
- export TF_SRC_ROOT=$(pwd)/tensorflow
3744

3845
script:
3946
- cd FaceTracker

Diff for: FaceTracker/app/CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
# value of 3.4.0 or lower.
44

55
cmake_minimum_required(VERSION 3.4.1)
6-
6+
set(CMAKE_VERBOSE_MAKEFILE on)
77
set (CMAKE_CXX_STANDARD 11)
88

9-
10-
# OpenCV stuff
119
include_directories($ENV{OPENCV_ANDROID_SDK}/sdk/native/jni/include)
1210
add_library( lib_opencv SHARED IMPORTED )
1311
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION $ENV{OPENCV_ANDROID_SDK}/sdk/native/libs/${ANDROID_ABI}/libopencv_java3.so)
@@ -84,4 +82,6 @@ target_link_libraries(
8482

8583
lib_opencv
8684

87-
${log-lib} )
85+
${log-lib} )
86+
87+
add_subdirectory("./jni")

Diff for: FaceTracker/app/build.gradle

+27-100
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,40 @@
1-
apply plugin: 'com.android.application'
1+
package org.opencv.android.facetracker;
22

3-
android {
4-
signingConfigs {
5-
config {
6-
keyAlias 'test'
7-
keyPassword 'test123321'
8-
storeFile file('signing/test.jks')
9-
storePassword 'test123321'
10-
}
11-
}
12-
compileSdkVersion 23
13-
buildToolsVersion '27.0.3'
14-
defaultConfig {
15-
applicationId "com.google.android.gms.samples.vision.face.facetracker"
16-
minSdkVersion 15
17-
targetSdkVersion 23
18-
versionCode 1
19-
versionName "1.0"
20-
externalNativeBuild {
21-
cmake {
22-
cppFlags "-frtti -fexceptions"
23-
//
24-
// abiFilters 'x86', 'armeabi-v7a', 'arm64-v8a'
25-
abiFilters 'armeabi-v7a'
26-
arguments "-DANDROID_STL=gnustl_shared"
27-
//arguments "-DANDROID_STL=c++_shared"
28-
// AL: arguments "-DANDROID_STL=c++_shared", "-DBUILD_opencv_apps:BOOL=ON", "-DBUILD_SHARED_LIBS:BOOL=ON"
29-
// Passes optional arguments to CMake.
30-
//arguments "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang"
31-
}
32-
}
33-
signingConfig signingConfigs.config
343

35-
// AL (
36-
// Specifies the application ID for the test APK.
37-
testApplicationId "org.opencv.android.facetracker"
38-
// Specifies the fully-qualified class name of the test instrumentation runner.
39-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
40-
// If set to 'true', enables the instrumentation class to start and stop profiling.
41-
// If set to false (default), profiling occurs the entire time the instrumentation
42-
// class is running.
43-
// testHandleProfiling true
44-
// If set to 'true', indicates that the Android system should run the instrumentation
45-
// class as a functional test. The default value is 'false'
46-
// testFunctionalTest true
47-
// AL )
4+
import android.content.Intent;
485

6+
import android.os.Bundle;
7+
import android.support.v7.app.AppCompatActivity;
8+
import android.view.View;
9+
import android.widget.Button;
4910

50-
}
5111

12+
import com.google.android.gms.samples.vision.face.facetracker.FaceTrackerActivity;
13+
import com.google.android.gms.samples.vision.face.facetracker.R;
5214

53-
// sourceSets { // AL: added
54-
// main {jniLibs.srcDirs = ['src/main/jniLibs']
55-
// jni.srcDirs = ['src/main/jni', 'src/main/jniLibs/'] //jni.srcDirs = [] } }
15+
import tensorflow.detector.spc.CameraActivityMain;
5616

57-
// allprojects { tasks.withType(JavaCompile) {
58-
// options.compilerArgs << "-Xlint:deprecation" }}
5917

18+
public class OpenCvActivity extends AppCompatActivity {
19+
private static final String TAG = "OpenCvActivity";
20+
private Button mBtnDetect;
6021

61-
buildTypes {
62-
release {
63-
minifyEnabled false
64-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
65-
signingConfig signingConfigs.config
66-
}
67-
}
6822

69-
externalNativeBuild {
70-
cmake {
71-
path "CMakeLists.txt"
72-
}
73-
}
23+
@Override
24+
public void onCreate(Bundle icicle) {
25+
super.onCreate(icicle);
26+
setContentView(R.layout.main);
7427

75-
testBuildType "release"
76-
externalNativeBuild {
77-
cmake {
78-
path "CMakeLists.txt"
79-
}
80-
}
81-
productFlavors {
82-
}
83-
lintOptions {
84-
abortOnError false
85-
}
86-
sourceSets {
87-
main { jniLibs.srcDirs = ['src/main/jniLibs'] }
88-
androidTest { // AL
89-
java.srcDir file('src/androidTest/java')
90-
resources.srcDir file('src/androidTest/assets')
91-
}
92-
//instrumentTest.setRoot('src/androidTest/')
93-
}
94-
configurations.all {
95-
resolutionStrategy.force 'com.android.support:support-annotations:23.4.0'
96-
}
97-
}
28+
mBtnDetect = (Button) findViewById(R.id.btnDetect);
29+
30+
mBtnDetect.setOnClickListener(new View.OnClickListener() {
31+
@Override
32+
public void onClick(View v) {
9833

99-
dependencies {
100-
implementation fileTree(include: ['*.jar'], dir: 'libs')
101-
androidTestImplementation 'junit:junit:4.12'
102-
implementation 'com.android.support:support-annotations:23.4.0'
103-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
104-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
105-
androidTestImplementation 'com.android.support.test:rules:1.0.2'
106-
androidTestImplementation 'org.hamcrest:hamcrest-library:1.3'
107-
implementation fileTree(include: ['*.jar'], dir: 'libs')
108-
implementation 'com.android.support:support-v4:23.4.0'
109-
implementation 'com.android.support:design:23.4.0'
110-
implementation 'com.google.android.gms:play-services-vision:9.4.0+'
111-
implementation 'com.shamanland:xdroid-toaster:0.2.4'
112-
implementation project(':openCVLibrary330')
34+
Intent myIntent = new Intent(OpenCvActivity.this, CameraActivityMain.class);
35+
36+
OpenCvActivity.this.startActivity(myIntent);
37+
}
38+
});
39+
}
11340
}

Diff for: FaceTracker/app/jni/CMakeLists.txt

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#
2+
# Copyright (C) 2016 The Android Open Source Project
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
project(TENSORFLOW_DETECTOR)
17+
cmake_minimum_required(VERSION 3.4.1)
18+
19+
set(CMAKE_VERBOSE_MAKEFILE on)
20+
21+
get_filename_component(SAMPLE_SRC_DIR ${CMAKE_SOURCE_DIR}/ ABSOLUTE)
22+
23+
if (ANDROID_ABI MATCHES "^armeabi-v7a$")
24+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=softfp -mfpu=neon")
25+
elseif(ANDROID_ABI MATCHES "^arm64-v8a")
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -ftree-vectorize")
27+
endif()
28+
29+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTANDALONE_DEMO_LIB \
30+
-std=c++11 -fno-exceptions -fno-rtti -O2 -Wno-narrowing \
31+
-fPIE")
32+
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \
33+
-Wl,--allow-multiple-definition \
34+
-Wl,--whole-archive -fPIE -v")
35+
36+
file(GLOB_RECURSE tensorflow_detector_sources ${SAMPLE_SRC_DIR}/jni/*.*)
37+
38+
find_library( # Sets the name of the path variable.
39+
log-lib
40+
41+
# Specifies the name of the NDK library that
42+
# you want CMake to locate.
43+
log )
44+
45+
add_library(tensorflow_detector SHARED
46+
${tensorflow_detector_sources})
47+
target_include_directories(tensorflow_detector PRIVATE
48+
${CMAKE_SOURCE_DIR})
49+
50+
target_link_libraries(tensorflow_detector
51+
android
52+
log
53+
jnigraphics
54+
m
55+
atomic
56+
z)

Diff for: FaceTracker/app/jni/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)