Skip to content

Commit 1a593d6

Browse files
committed
disable identify button temporarly. try to fix build
1 parent ad52dfe commit 1a593d6

File tree

6 files changed

+57
-47
lines changed

6 files changed

+57
-47
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ android:
3030
before_install:
3131
- echo $(ant -version)
3232

33+
before_script:
34+
- wget https://github.com/opencv/opencv/releases/download/3.4.1/opencv-3.4.1-android-sdk.zip
35+
- unzip -q opencv-3.4.1-android-sdk.zip
36+
- export OPENCV_ANDROID_SDK=$(pwd)/OpenCV-android-sdk
37+
3338
script:
3439
- cd visionSamples/FaceTracker/
3540
- ./gradlew build

FaceTracker/app/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@ set (CMAKE_CXX_STANDARD 11)
88

99

1010
# OpenCV stuff
11-
# todo: use env variable to set opencv location
12-
include_directories("/Users/hoopoe/Tools/OpenCV-android-sdk/sdk/native/jni/include")
11+
include_directories($ENV{OPENCV_ANDROID_SDK}/sdk/native/jni/include)
1312
add_library( lib_opencv SHARED IMPORTED )
14-
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION /Users/hoopoe/Tools/OpenCV-android-sdk/sdk/native/libs/${ANDROID_ABI}/libopencv_java3.so)
13+
set_target_properties(lib_opencv PROPERTIES IMPORTED_LOCATION $ENV{OPENCV_ANDROID_SDK}/sdk/native/libs/${ANDROID_ABI}/libopencv_java3.so)
1514

1615
find_library( # Sets the name of the path variable.
1716
log-lib
@@ -23,7 +22,7 @@ find_library( # Sets the name of the path variable.
2322
set(DLIB_DIR ../../dlib)
2423
include_directories(${DLIB_DIR})
2524
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
26-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
25+
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
2726

2827
add_library( # Sets the name of the library.
2928
lib_dlib

FaceTracker/app/src/main/java/com/google/android/gms/samples/vision/face/facetracker/FaceTrackerActivity.java

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public final class FaceTrackerActivity extends AppCompatActivity {
6060

6161
private CameraSourcePreview mPreview;
6262
private GraphicOverlay mGraphicOverlay;
63-
private Button mBtnDetect;
63+
// private Button mBtnDetect;
6464
private CustomDetector customDetector;
6565
//private FaceDetector mPictureDetector;
6666

@@ -85,7 +85,7 @@ public void onCreate(Bundle icicle) {
8585

8686
mPreview = (CameraSourcePreview) findViewById(R.id.preview);
8787
mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);
88-
mBtnDetect = (Button) findViewById(R.id.btnDetect);
88+
// mBtnDetect = (Button) findViewById(R.id.btnDetect);
8989
mFaceRecognizer = new FaceRecognizer();
9090

9191
// Check for the sdcard write permission. If the
@@ -228,36 +228,36 @@ private void createCameraSource() {
228228
.setRequestedFps(10)
229229
.build();
230230

231-
mBtnDetect.setOnClickListener(new View.OnClickListener() {
232-
@Override
233-
public void onClick(View v) {
234-
mCameraSource.takePicture(null, new CameraSource.PictureCallback() {
235-
@Override
236-
public void onPictureTaken(byte[] bytes) {
237-
BitmapFactory.Options options = new BitmapFactory.Options();
238-
final Bitmap temp = BitmapFactory.decodeByteArray(bytes, 0,
239-
bytes.length, options);
240-
241-
//Log.d(TAG, temp.getWidth() + " " + temp.getHeight());
242-
// Frame frame = new Frame.Builder().setBitmap(temp).build();
243-
// SparseArray<Face> faces = mPictureDetector.detect(frame);
244-
// Log.d(TAG, String.format("Num of faces %d", faces.size()));
245-
246-
Toast toast = Toast.makeText(getApplicationContext(),
247-
"Long detection started...(~1min)", Toast.LENGTH_SHORT);
248-
toast.show();
249-
250-
new Thread(new Runnable() {
251-
@Override
252-
public void run() {
253-
String[] array = mFaceRecognizer.recognizeFaces(temp);
254-
Toaster.toastLong(TextUtils.join(",", array));
255-
}
256-
}).start();
257-
}
258-
});
259-
}
260-
});
231+
// mBtnDetect.setOnClickListener(new View.OnClickListener() {
232+
// @Override
233+
// public void onClick(View v) {
234+
// mCameraSource.takePicture(null, new CameraSource.PictureCallback() {
235+
// @Override
236+
// public void onPictureTaken(byte[] bytes) {
237+
// BitmapFactory.Options options = new BitmapFactory.Options();
238+
// final Bitmap temp = BitmapFactory.decodeByteArray(bytes, 0,
239+
// bytes.length, options);
240+
//
241+
// //Log.d(TAG, temp.getWidth() + " " + temp.getHeight());
242+
//// Frame frame = new Frame.Builder().setBitmap(temp).build();
243+
//// SparseArray<Face> faces = mPictureDetector.detect(frame);
244+
//// Log.d(TAG, String.format("Num of faces %d", faces.size()));
245+
//
246+
// Toast toast = Toast.makeText(getApplicationContext(),
247+
// "Long detection started...(~1min)", Toast.LENGTH_SHORT);
248+
// toast.show();
249+
//
250+
// new Thread(new Runnable() {
251+
// @Override
252+
// public void run() {
253+
// String[] array = mFaceRecognizer.recognizeFaces(temp);
254+
// Toaster.toastLong(TextUtils.join(",", array));
255+
// }
256+
// }).start();
257+
// }
258+
// });
259+
// }
260+
// });
261261
}
262262

263263
/**

FaceTracker/app/src/main/res/layout-land/main.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
android:layout_width="match_parent"
88
android:layout_height="match_parent"
99
android:keepScreenOn="true">
10-
<Button
11-
android:id="@+id/btnDetect"
12-
android:layout_width="35dp"
13-
android:layout_height="wrap_content"
14-
android:text="Identify" />
10+
<!--<Button-->
11+
<!--android:id="@+id/btnDetect"-->
12+
<!--android:layout_width="35dp"-->
13+
<!--android:layout_height="wrap_content"-->
14+
<!--android:text="Identify" />-->
1515
<com.google.android.gms.samples.vision.face.facetracker.ui.camera.CameraSourcePreview
1616
android:id="@+id/preview"
1717
android:layout_width="match_parent"

FaceTracker/app/src/main/res/layout/main.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
android:keepScreenOn="true">
1010

1111

12-
<Button
13-
android:id="@+id/btnDetect"
14-
android:layout_width="350dp"
15-
android:layout_height="wrap_content"
16-
android:text="Identify" />
12+
<!--<Button-->
13+
<!--android:id="@+id/btnDetect"-->
14+
<!--android:layout_width="350dp"-->
15+
<!--android:layout_height="wrap_content"-->
16+
<!--android:text="Identify" />-->
1717

1818
<com.google.android.gms.samples.vision.face.facetracker.ui.camera.CameraSourcePreview
1919
android:id="@+id/preview"

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@ Facial Recognition on Android using dlib and opencv
44
============
55

66
This app demonstrate realtime face detection, tracking and recognition based on predefined face vectors.
7-
87
============
8+
9+
Notes:
10+
1. set env variable OPENCV_ANDROID_SDK
11+
export OPENCV_ANDROID_SDK=/Users/hoopoe/Tools/OpenCV-android-sdk
12+
13+
2. dlib adapted to work with -DANDROID_STL=gnustl_shared
14+

0 commit comments

Comments
 (0)