├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── libraries │ ├── activation.xml │ ├── additionnal.xml │ ├── animated_vector_drawable_23_2_1.xml │ ├── appcompat_v7_23_2_1.xml │ ├── artoolkitplus_2_3_1_1_1.xml │ ├── ffmpeg_2_8_1_1_1.xml │ ├── flandmark_1_07_1_1.xml │ ├── flycapture_2_8_3_1_1_1.xml │ ├── hamcrest_core_1_3.xml │ ├── javacpp.xml │ ├── javacpp_1_1.xml │ ├── javacv.xml │ ├── javacv_1_1.xml │ ├── junit_4_12.xml │ ├── libdc1394_2_2_3_1_1.xml │ ├── libfreenect_0_5_3_1_1.xml │ ├── mail.xml │ ├── opencv_3_0_0_1_1.xml │ ├── support_annotations_23_2_1.xml │ ├── support_v4_18_0_0.xml │ ├── support_v4_23_2_1.xml │ ├── support_vector_drawable_23_2_1.xml │ └── videoinput_0_200_1_1.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── workspace.xml ├── JavaCVDemo.iml ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── net │ │ └── archeryc │ │ └── javacvdemo │ │ └── ApplicationTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── net │ │ │ └── archeryc │ │ │ └── javacvdemo │ │ │ ├── FacePreview.java │ │ │ └── MainActivity.java │ ├── res │ │ ├── layout │ │ │ └── activity_main.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ └── resources │ │ └── com │ │ └── googlecode │ │ └── javacv │ │ └── facepreview │ │ └── haarcascade_frontalface_alt2.xml │ └── test │ └── java │ └── net │ └── archeryc │ └── javacvdemo │ └── ExampleUnitTest.java ├── build.gradle ├── faceRecognizer ├── build.gradle ├── faceRecognizer.iml ├── libs │ ├── activation.jar │ ├── additionnal.jar │ ├── javacpp.jar │ ├── javacv.jar │ └── mail.jar └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── edu │ │ └── uj │ │ └── faceRecognizer │ │ └── faceRecognition │ │ ├── FaceRecognizer.java │ │ ├── FaceView.java │ │ ├── ImageUtilities.java │ │ ├── MainActivity.java │ │ ├── PersonActivity.java │ │ ├── Preview.java │ │ └── utilities │ │ ├── AppPreferences.java │ │ └── ToastHelper.java │ ├── jniLibs │ └── armeabi-v7a │ │ ├── libavcodec.so │ │ ├── libavdevice.so │ │ ├── libavfilter.so │ │ ├── libavformat.so │ │ ├── libavutil.so │ │ ├── libjniARToolKitPlus.so │ │ ├── libjniavcodec.so │ │ ├── libjniavdevice.so │ │ ├── libjniavfilter.so │ │ ├── libjniavformat.so │ │ ├── libjniavutil.so │ │ ├── libjnicvkernels.so │ │ ├── libjniopencv_calib3d.so │ │ ├── libjniopencv_contrib.so │ │ ├── libjniopencv_core.so │ │ ├── libjniopencv_features2d.so │ │ ├── libjniopencv_flann.so │ │ ├── libjniopencv_highgui.so │ │ ├── libjniopencv_imgproc.so │ │ ├── libjniopencv_legacy.so │ │ ├── libjniopencv_ml.so │ │ ├── libjniopencv_nonfree.so │ │ ├── libjniopencv_objdetect.so │ │ ├── libjniopencv_photo.so │ │ ├── libjniopencv_stitching.so │ │ ├── libjniopencv_video.so │ │ ├── libjniopencv_videostab.so │ │ ├── libjnipostproc.so │ │ ├── libjniswresample.so │ │ ├── libjniswscale.so │ │ ├── libopencv_calib3d.so │ │ ├── libopencv_contrib.so │ │ ├── libopencv_core.so │ │ ├── libopencv_features2d.so │ │ ├── libopencv_flann.so │ │ ├── libopencv_highgui.so │ │ ├── libopencv_imgproc.so │ │ ├── libopencv_legacy.so │ │ ├── libopencv_ml.so │ │ ├── libopencv_nonfree.so │ │ ├── libopencv_objdetect.so │ │ ├── libopencv_photo.so │ │ ├── libopencv_stitching.so │ │ ├── libopencv_ts.so │ │ ├── libopencv_video.so │ │ ├── libopencv_videostab.so │ │ ├── libpostproc.so │ │ ├── libswresample.so │ │ └── libswscale.so │ ├── res │ ├── drawable-hdpi │ │ └── ic_launcher.png │ ├── drawable-ldpi │ │ └── ic_launcher.png │ ├── drawable-mdpi │ │ └── ic_launcher.png │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ ├── drawable │ │ ├── Thumbs.db │ │ ├── face.bmp │ │ └── ja.png │ ├── layout │ │ ├── activity_main.xml │ │ ├── person_activity.xml │ │ └── set_email_layout.xml │ ├── menu │ │ └── activity_main.xml │ ├── values-v11 │ │ └── styles.xml │ ├── values-v14 │ │ └── styles.xml │ └── values │ │ ├── strings.xml │ │ └── styles.xml │ └── resources │ └── edu │ └── uj │ └── faceRecognizer │ └── faceRecognition │ └── utilities │ ├── haarcascade_frontalface_alt.xml │ └── haarcascade_frontalface_alt2.xml ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── import-summary.txt └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log 27 | 28 | # Android Studio Navigation editor temp files 29 | .navigation/ 30 | 31 | # Android Studio captures folder 32 | captures/ 33 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | FaceRecognizer -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 24 | 25 | -------------------------------------------------------------------------------- /.idea/libraries/activation.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/additionnal.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/animated_vector_drawable_23_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/appcompat_v7_23_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/libraries/artoolkitplus_2_3_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/ffmpeg_2_8_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/flandmark_1_07_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/flycapture_2_8_3_1_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/javacpp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javacpp_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/javacv.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/javacv_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/libdc1394_2_2_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/libfreenect_0_5_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/mail.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/opencv_3_0_0_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_annotations_23_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_18_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/libraries/support_v4_23_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/support_vector_drawable_23_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/videoinput_0_200_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 1.8 51 | 52 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /JavaCVDemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "net.archeryc.javacvdemo" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | repositories { 21 | mavenCentral() 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | testCompile 'junit:junit:4.12' 28 | compile 'com.android.support:appcompat-v7:23.2.1' 29 | compile group: 'org.bytedeco', name: 'javacv', version: '1.1' 30 | } 31 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Android\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/net/archeryc/javacvdemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package net.archeryc.javacvdemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/java/net/archeryc/javacvdemo/FacePreview.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2010,2011,2012 Samuel Audet 3 | * 4 | * FacePreview - A fusion of OpenCV's facedetect and Android's CameraPreview samples, 5 | * with JavaCV + JavaCPP as the glue in between. 6 | * 7 | * This file was based on CameraPreview.java that came with the Samples for 8 | * Android SDK API 8, revision 1 and contained the following copyright notice: 9 | * 10 | * Copyright (C) 2007 The Android Open Source Project 11 | * 12 | * Licensed under the Apache License, Version 2.0 (the "License"); 13 | * you may not use this file except in compliance with the License. 14 | * You may obtain a copy of the License at 15 | * 16 | * http://www.apache.org/licenses/LICENSE-2.0 17 | * 18 | * Unless required by applicable law or agreed to in writing, software 19 | * distributed under the License is distributed on an "AS IS" BASIS, 20 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 21 | * See the License for the specific language governing permissions and 22 | * limitations under the License. 23 | * 24 | * 25 | * IMPORTANT - Make sure the AndroidManifest.xml file looks like this: 26 | * 27 | * 28 | * 32 | * 33 | * 34 | * 35 | * 36 | * 40 | * 41 | * 42 | * 43 | * 44 | * 45 | * 46 | * 47 | */ 48 | 49 | package net.archeryc.javacvdemo; 50 | 51 | import android.app.Activity; 52 | import android.app.AlertDialog; 53 | import android.content.Context; 54 | import android.graphics.Canvas; 55 | import android.graphics.Color; 56 | import android.graphics.ImageFormat; 57 | import android.graphics.Paint; 58 | import android.hardware.Camera; 59 | import android.hardware.Camera.Size; 60 | import android.os.Bundle; 61 | import android.view.SurfaceHolder; 62 | import android.view.SurfaceView; 63 | import android.view.View; 64 | import android.view.Window; 65 | import android.view.WindowManager; 66 | import android.widget.FrameLayout; 67 | import java.io.File; 68 | import java.io.IOException; 69 | import java.nio.ByteBuffer; 70 | import java.util.List; 71 | import org.bytedeco.javacpp.Loader; 72 | import org.bytedeco.javacpp.opencv_objdetect; 73 | 74 | import static org.bytedeco.javacpp.opencv_core.*; 75 | import static org.bytedeco.javacpp.opencv_imgproc.*; 76 | import static org.bytedeco.javacpp.opencv_objdetect.*; 77 | import static org.bytedeco.javacpp.opencv_imgcodecs.*; 78 | 79 | // ---------------------------------------------------------------------- 80 | 81 | public class FacePreview extends Activity { 82 | private FrameLayout layout; 83 | private FaceView faceView; 84 | private Preview mPreview; 85 | 86 | @Override 87 | protected void onCreate(Bundle savedInstanceState) { 88 | // Hide the window title. 89 | requestWindowFeature(Window.FEATURE_NO_TITLE); 90 | 91 | super.onCreate(savedInstanceState); 92 | 93 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); 94 | 95 | // Create our Preview view and set it as the content of our activity. 96 | try { 97 | layout = new FrameLayout(this); 98 | faceView = new FaceView(this); 99 | mPreview = new Preview(this, faceView); 100 | layout.addView(mPreview); 101 | layout.addView(faceView); 102 | setContentView(layout); 103 | } catch (IOException e) { 104 | e.printStackTrace(); 105 | new AlertDialog.Builder(this).setMessage(e.getMessage()).create().show(); 106 | } 107 | } 108 | } 109 | 110 | // ---------------------------------------------------------------------- 111 | 112 | class FaceView extends View implements Camera.PreviewCallback { 113 | public static final int SUBSAMPLING_FACTOR = 4; 114 | 115 | private IplImage grayImage; 116 | private CvHaarClassifierCascade classifier; 117 | private CvMemStorage storage; 118 | private CvSeq faces; 119 | 120 | public FaceView(FacePreview context) throws IOException { 121 | super(context); 122 | 123 | // Load the classifier file from Java resources. 124 | File classifierFile = Loader.extractResource(getClass(), 125 | "/net/archeryc/javacvdemo/haarcascade_frontalface_alt.xml", 126 | context.getCacheDir(), "classifier", ".xml"); 127 | if (classifierFile == null || classifierFile.length() <= 0) { 128 | throw new IOException("Could not extract the classifier file from Java resource."); 129 | } 130 | 131 | // Preload the opencv_objdetect module to work around a known bug. 132 | Loader.load(opencv_objdetect.class); 133 | classifier = new CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath())); 134 | classifierFile.delete(); 135 | if (classifier.isNull()) { 136 | throw new IOException("Could not load the classifier file."); 137 | } 138 | storage = CvMemStorage.create(); 139 | } 140 | 141 | public void onPreviewFrame(final byte[] data, final Camera camera) { 142 | try { 143 | Size size = camera.getParameters().getPreviewSize(); 144 | processImage(data, size.width, size.height); 145 | camera.addCallbackBuffer(data); 146 | } catch (RuntimeException e) { 147 | // The camera has probably just been released, ignore. 148 | } 149 | } 150 | 151 | protected void processImage(byte[] data, int width, int height) { 152 | // First, downsample our image and convert it into a grayscale IplImage 153 | int f = SUBSAMPLING_FACTOR; 154 | if (grayImage == null || grayImage.width() != width/f || grayImage.height() != height/f) { 155 | grayImage = IplImage.create(width/f, height/f, IPL_DEPTH_8U, 1); 156 | } 157 | int imageWidth = grayImage.width(); 158 | int imageHeight = grayImage.height(); 159 | int dataStride = f*width; 160 | int imageStride = grayImage.widthStep(); 161 | ByteBuffer imageBuffer = grayImage.getByteBuffer(); 162 | for (int y = 0; y < imageHeight; y++) { 163 | int dataLine = y*dataStride; 164 | int imageLine = y*imageStride; 165 | for (int x = 0; x < imageWidth; x++) { 166 | imageBuffer.put(imageLine + x, data[dataLine + f*x]); 167 | } 168 | } 169 | 170 | cvClearMemStorage(storage); 171 | faces = cvHaarDetectObjects(grayImage, classifier, storage, 1.1, 3, 172 | CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_DO_ROUGH_SEARCH); 173 | postInvalidate(); 174 | } 175 | 176 | @Override 177 | protected void onDraw(Canvas canvas) { 178 | Paint paint = new Paint(); 179 | paint.setColor(Color.RED); 180 | paint.setTextSize(20); 181 | 182 | String s = "FacePreview - This side up."; 183 | float textWidth = paint.measureText(s); 184 | canvas.drawText(s, (getWidth()-textWidth)/2, 20, paint); 185 | 186 | if (faces != null) { 187 | paint.setStrokeWidth(2); 188 | paint.setStyle(Paint.Style.STROKE); 189 | float scaleX = (float)getWidth()/grayImage.width(); 190 | float scaleY = (float)getHeight()/grayImage.height(); 191 | int total = faces.total(); 192 | for (int i = 0; i < total; i++) { 193 | CvRect r = new CvRect(cvGetSeqElem(faces, i)); 194 | int x = r.x(), y = r.y(), w = r.width(), h = r.height(); 195 | canvas.drawRect(x*scaleX, y*scaleY, (x+w)*scaleX, (y+h)*scaleY, paint); 196 | } 197 | } 198 | } 199 | } 200 | 201 | // ---------------------------------------------------------------------- 202 | 203 | class Preview extends SurfaceView implements SurfaceHolder.Callback { 204 | SurfaceHolder mHolder; 205 | Camera mCamera; 206 | Camera.PreviewCallback previewCallback; 207 | 208 | Preview(Context context, Camera.PreviewCallback previewCallback) { 209 | super(context); 210 | this.previewCallback = previewCallback; 211 | 212 | // Install a SurfaceHolder.Callback so we get notified when the 213 | // underlying surface is created and destroyed. 214 | mHolder = getHolder(); 215 | mHolder.addCallback(this); 216 | mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); 217 | } 218 | 219 | public void surfaceCreated(SurfaceHolder holder) { 220 | // The Surface has been created, acquire the camera and tell it where 221 | // to draw. 222 | mCamera = Camera.open(); 223 | try { 224 | mCamera.setPreviewDisplay(holder); 225 | } catch (IOException exception) { 226 | mCamera.release(); 227 | mCamera = null; 228 | // TODO: add more exception handling logic here 229 | } 230 | } 231 | 232 | public void surfaceDestroyed(SurfaceHolder holder) { 233 | // Surface will be destroyed when we return, so stop the preview. 234 | // Because the CameraDevice object is not a shared resource, it's very 235 | // important to release it when the activity is paused. 236 | mCamera.stopPreview(); 237 | mCamera.release(); 238 | mCamera = null; 239 | } 240 | 241 | 242 | private Size getOptimalPreviewSize(List sizes, int w, int h) { 243 | final double ASPECT_TOLERANCE = 0.05; 244 | double targetRatio = (double) w / h; 245 | if (sizes == null) return null; 246 | 247 | Size optimalSize = null; 248 | double minDiff = Double.MAX_VALUE; 249 | 250 | int targetHeight = h; 251 | 252 | // Try to find an size match aspect ratio and size 253 | for (Size size : sizes) { 254 | double ratio = (double) size.width / size.height; 255 | if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE) continue; 256 | if (Math.abs(size.height - targetHeight) < minDiff) { 257 | optimalSize = size; 258 | minDiff = Math.abs(size.height - targetHeight); 259 | } 260 | } 261 | 262 | // Cannot find the one match the aspect ratio, ignore the requirement 263 | if (optimalSize == null) { 264 | minDiff = Double.MAX_VALUE; 265 | for (Size size : sizes) { 266 | if (Math.abs(size.height - targetHeight) < minDiff) { 267 | optimalSize = size; 268 | minDiff = Math.abs(size.height - targetHeight); 269 | } 270 | } 271 | } 272 | return optimalSize; 273 | } 274 | 275 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { 276 | // Now that the size is known, set up the camera parameters and begin 277 | // the preview. 278 | Camera.Parameters parameters = mCamera.getParameters(); 279 | 280 | List sizes = parameters.getSupportedPreviewSizes(); 281 | Size optimalSize = getOptimalPreviewSize(sizes, w, h); 282 | parameters.setPreviewSize(optimalSize.width, optimalSize.height); 283 | 284 | mCamera.setParameters(parameters); 285 | if (previewCallback != null) { 286 | mCamera.setPreviewCallbackWithBuffer(previewCallback); 287 | Size size = parameters.getPreviewSize(); 288 | byte[] data = new byte[size.width*size.height* 289 | ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8]; 290 | mCamera.addCallbackBuffer(data); 291 | } 292 | mCamera.startPreview(); 293 | } 294 | 295 | } 296 | -------------------------------------------------------------------------------- /app/src/main/java/net/archeryc/javacvdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package net.archeryc.javacvdemo; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | 6 | public class MainActivity extends AppCompatActivity { 7 | 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | setContentView(R.layout.activity_main); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | JavaCVDemo 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/net/archeryc/javacvdemo/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package net.archeryc.javacvdemo; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 9 | */ 10 | public class ExampleUnitTest { 11 | @Test 12 | public void addition_isCorrect() throws Exception { 13 | assertEquals(4, 2 + 2); 14 | } 15 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.0.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /faceRecognizer/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 16 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "edu.uj.faceRecognizer.faceRecognition" 9 | minSdkVersion 8 10 | targetSdkVersion 17 11 | } 12 | 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile 'com.android.support:support-v4:18.+' 23 | compile files('libs/activation.jar') 24 | compile files('libs/additionnal.jar') 25 | compile files('libs/javacpp.jar') 26 | compile files('libs/javacv.jar') 27 | compile files('libs/mail.jar') 28 | } 29 | -------------------------------------------------------------------------------- /faceRecognizer/faceRecognizer.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /faceRecognizer/libs/activation.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/libs/activation.jar -------------------------------------------------------------------------------- /faceRecognizer/libs/additionnal.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/libs/additionnal.jar -------------------------------------------------------------------------------- /faceRecognizer/libs/javacpp.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/libs/javacpp.jar -------------------------------------------------------------------------------- /faceRecognizer/libs/javacv.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/libs/javacv.jar -------------------------------------------------------------------------------- /faceRecognizer/libs/mail.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/libs/mail.jar -------------------------------------------------------------------------------- /faceRecognizer/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/FaceRecognizer.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition; 2 | 3 | import android.content.Context; 4 | import android.os.Environment; 5 | import android.os.Handler; 6 | import android.util.Log; 7 | 8 | import com.googlecode.javacpp.Loader; 9 | import com.googlecode.javacv.cpp.opencv_contrib; 10 | import com.googlecode.javacv.cpp.opencv_core; 11 | import com.googlecode.javacv.cpp.opencv_objdetect; 12 | 13 | import edu.uj.faceRecognizer.faceRecognition.utilities.ToastHelper; 14 | 15 | import java.io.File; 16 | import java.io.FilenameFilter; 17 | import java.io.IOException; 18 | import java.nio.ByteBuffer; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | import static com.googlecode.javacv.cpp.opencv_core.*; 23 | import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage; 24 | import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage; 25 | import static com.googlecode.javacv.cpp.opencv_imgproc.CV_BGR2GRAY; 26 | import static com.googlecode.javacv.cpp.opencv_imgproc.cvCvtColor; 27 | import static com.googlecode.javacv.cpp.opencv_imgproc.cvResize; 28 | import static com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING; 29 | import static com.googlecode.javacv.cpp.opencv_objdetect.cvHaarDetectObjects; 30 | 31 | /** 32 | * User: piotrplaneta 33 | * Date: 21.01.2013 34 | * Time: 20:28 35 | */ 36 | public class FaceRecognizer { 37 | 38 | opencv_contrib.FaceRecognizer faceRecognizer; 39 | public static final int SUBSAMPLING_FACTOR = 3; 40 | private Map names; 41 | private opencv_core.IplImage grayImage; 42 | private opencv_objdetect.CvHaarClassifierCascade classifier; 43 | private opencv_core.CvMemStorage storage; 44 | private opencv_core.CvSeq faces; 45 | private Context context; 46 | 47 | public float getScaleX(int viewWidth) { 48 | return viewWidth / (float) grayImage.width(); 49 | } 50 | 51 | public float getScaleY(int viewHeight) { 52 | return viewHeight / (float) grayImage.height(); 53 | } 54 | 55 | public CvSeq getFaces() { 56 | return faces; 57 | } 58 | 59 | public FaceRecognizer(final Context context, final Handler handler) throws IOException { 60 | this.context = context; 61 | new Thread(new Runnable() { 62 | @Override 63 | public void run() { 64 | //加载分类器文件 65 | File classifierFile = null; 66 | try { 67 | classifierFile = Loader.extractResource(getClass(), 68 | "/edu/uj/faceRecognizer/faceRecognition/utilities/haarcascade_frontalface_alt2.xml", 69 | context.getCacheDir(), "classifier", ".xml"); 70 | } catch (IOException e) { 71 | e.printStackTrace(); 72 | } 73 | if (classifierFile == null || classifierFile.length() <= 0) { 74 | try { 75 | throw new IOException("Could not extract the classifier file from Java resource."); 76 | } catch (IOException e) { 77 | e.printStackTrace(); 78 | } 79 | } 80 | 81 | // Preload the opencv_objdetect module to work around a known bug. 82 | Loader.load(opencv_objdetect.class); 83 | classifier = new opencv_objdetect.CvHaarClassifierCascade(cvLoad(classifierFile.getAbsolutePath())); 84 | classifierFile.delete(); 85 | if (classifier.isNull()) { 86 | try { 87 | throw new IOException("Could not load the classifier file."); 88 | } catch (IOException e) { 89 | e.printStackTrace(); 90 | } 91 | } 92 | storage = opencv_core.CvMemStorage.create(); 93 | 94 | loadFaceRecognizer(); 95 | handler.sendEmptyMessage(FaceView.LOAD_OVER); 96 | } 97 | }).start(); 98 | // Load the classifier file from Java resources. 99 | 100 | } 101 | 102 | private void loadFaceRecognizer() { 103 | 104 | File root = new File(Environment.getExternalStorageDirectory().getPath() + "/faceRecognizer/"); 105 | 106 | if (root == null) { 107 | ToastHelper.notify(context, "No training directory"); 108 | return; 109 | } 110 | 111 | FilenameFilter jpg = new FilenameFilter() { 112 | public boolean accept(File dir, String name) { 113 | return name.toLowerCase().endsWith(".jpg"); 114 | } 115 | }; 116 | //加载所有的图片 117 | File[] imageFiles = root.listFiles(jpg); 118 | 119 | opencv_core.MatVector images = new opencv_core.MatVector(imageFiles.length); 120 | int[] labels = new int[imageFiles.length]; 121 | 122 | int counter = 0; 123 | String label; 124 | 125 | opencv_core.IplImage img; 126 | opencv_core.IplImage grayImg; 127 | 128 | names = new HashMap(); 129 | names.put("unknown", -1); 130 | 131 | int i = 0; 132 | //将每个图片处理成灰度图 133 | for (File image : imageFiles) { 134 | img = cvLoadImage(image.getAbsolutePath()); 135 | //图片处理,转换成灰度图。 136 | grayImg = opencv_core.IplImage.create(img.width(), img.height(), IPL_DEPTH_8U, 1); 137 | cvCvtColor(img, grayImg, CV_BGR2GRAY); 138 | 139 | label = image.getName().split("\\-")[0]; 140 | 141 | //根据图片文件名,读取每个人的姓名 142 | if(!names.containsKey(label)) { 143 | i++; 144 | names.put(label, i); 145 | } 146 | 147 | 148 | images.put(counter, grayImg); 149 | labels[counter] = i; 150 | counter++; 151 | 152 | Log.i("faceRecognizer", String.valueOf(label)); 153 | } 154 | 155 | //初始化LBP人脸识别器 156 | faceRecognizer = com.googlecode.javacv.cpp.opencv_contrib.createLBPHFaceRecognizer(); 157 | 158 | faceRecognizer.set("threshold", 4000.0); 159 | 160 | try { 161 | //训练所有的图片 162 | faceRecognizer.train(images, labels); 163 | } catch (Exception e) { 164 | ToastHelper.notify(context, "Problem with training"); 165 | Log.e("faceRecognizer", e.getMessage()); 166 | } 167 | 168 | } 169 | 170 | protected String processImage(byte[] data, int width, int height) { 171 | Log.i("faceRecognizer", "procesimage"); 172 | String name=""; 173 | int f = SUBSAMPLING_FACTOR; 174 | //创建一个人脸灰度图,用于稍后人脸检测 175 | if (grayImage == null || grayImage.width() != width/f || grayImage.height() != height/f) { 176 | grayImage = opencv_core.IplImage.create(width / f, height / f, IPL_DEPTH_8U, 1); 177 | } 178 | int imageWidth = grayImage.width(); 179 | int imageHeight = grayImage.height(); 180 | int dataStride = f*width; 181 | int imageStride = grayImage.widthStep(); 182 | ByteBuffer imageBuffer = grayImage.getByteBuffer(); 183 | for (int y = 0; y < imageHeight; y++) { 184 | int dataLine = y*dataStride; 185 | int imageLine = y*imageStride; 186 | for (int x = 0; x < imageWidth; x++) { 187 | imageBuffer.put(imageLine + x, data[dataLine + f*x]); 188 | } 189 | } 190 | 191 | //初始化haar人脸检测器 192 | faces = cvHaarDetectObjects(grayImage, classifier, storage, 1.1, 3, CV_HAAR_DO_CANNY_PRUNING); 193 | if (faces != null) { 194 | int total = faces.total(); 195 | if (total > 1) { 196 | total = 1; 197 | } 198 | for (int i = 0; i < total; i++) { //人脸识别只识别一个 199 | opencv_core.CvRect r = new opencv_core.CvRect(cvGetSeqElem(faces, i)); 200 | 201 | 202 | opencv_core.IplImage faceToRecognize = getFace(grayImage, r); 203 | 204 | if (faceToRecognize != null) { 205 | //获取识别出的姓名 206 | name=predictFace(faceToRecognize); 207 | } 208 | } 209 | } 210 | 211 | cvClearMemStorage(storage); 212 | return name; 213 | } 214 | 215 | //人脸识别 216 | private String predictFace(opencv_core.IplImage testImage) { 217 | if (testImage == null) { 218 | ToastHelper.notify(context, "No test image"); 219 | return ""; 220 | } 221 | 222 | if (faceRecognizer != null) { 223 | try { 224 | String recognizedPerson = ""; 225 | //灰度图放到识别器里识别 226 | int predictedLabel = faceRecognizer.predict(testImage); 227 | 228 | for (Map.Entry entry : names.entrySet()) { 229 | if (entry.getValue().equals(predictedLabel)) { 230 | 231 | ToastHelper.notify(context, entry.getKey()); 232 | recognizedPerson = entry.getKey(); 233 | } 234 | 235 | } 236 | if(predictedLabel != -1) { 237 | ToastHelper.notify(context,"识别成功!"); 238 | // ((MainActivity) context).stopPreview(); 239 | // MailSender.sendEmail(context, recognizedPerson); 240 | } 241 | return recognizedPerson; 242 | } catch (Exception e) { 243 | ToastHelper.notify(context, "Problem with predicting!" + e.getMessage()); 244 | Log.e("faceRecognizer", e.getMessage()); 245 | return ""; 246 | } 247 | } else { 248 | ToastHelper.notify(context, "FaceRecognizer not initialized yet!"); 249 | return ""; 250 | } 251 | } 252 | 253 | //从灰度图中扣出人脸的部分并保存到本地 254 | private IplImage getFace(IplImage image, CvRect region) { 255 | IplImage imageCropped; 256 | CvSize size = new CvSize(); 257 | ImageUtilities.getResizedFragment(region); 258 | Log.i("faceRecognizer", region.toString()); 259 | 260 | if(image != null && ImageUtilities.isRegionValid(region, image.width(), image.height())) { 261 | cvResetImageROI(image); 262 | cvSetImageROI(image, region); 263 | 264 | 265 | size.width(region.width()); 266 | size.height(region.height()); 267 | 268 | imageCropped = cvCreateImage(size, IPL_DEPTH_8U, 1); 269 | 270 | cvCopy(image, imageCropped); 271 | cvResetImageROI(image); 272 | IplImage imageResized; 273 | size.width(200); 274 | size.height(150); 275 | imageResized = cvCreateImage(size, IPL_DEPTH_8U, 1); 276 | cvResize(imageCropped, imageResized); 277 | 278 | File testFile = new File(Environment.getExternalStorageDirectory().getPath() + "/faceRecognizerTest/test.png"); 279 | cvSaveImage(testFile.getAbsolutePath(), imageResized); 280 | return imageResized; 281 | } 282 | 283 | return null; 284 | 285 | } 286 | 287 | } 288 | -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/FaceView.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition; 2 | 3 | import android.app.ProgressDialog; 4 | import android.content.Context; 5 | import android.graphics.Canvas; 6 | import android.graphics.Color; 7 | import android.graphics.Paint; 8 | import android.hardware.Camera; 9 | import android.os.Handler; 10 | import android.os.Message; 11 | import android.util.Log; 12 | import android.view.View; 13 | import android.widget.Toast; 14 | 15 | import edu.uj.faceRecognizer.faceRecognition.utilities.ToastHelper; 16 | 17 | import com.googlecode.javacpp.Pointer; 18 | import com.googlecode.javacv.cpp.opencv_highgui.CvCapture; 19 | 20 | import static com.googlecode.javacv.cpp.opencv_core.*; 21 | import static com.googlecode.javacv.cpp.opencv_imgproc.*; 22 | import static com.googlecode.javacv.cpp.opencv_highgui.*; 23 | import static com.googlecode.javacv.cpp.opencv_video.*; 24 | 25 | import java.io.IOException; 26 | 27 | import static com.googlecode.javacv.cpp.opencv_core.*; 28 | 29 | class FaceView extends View implements Camera.PreviewCallback { 30 | public static final int LOAD_OVER=1; 31 | private FaceRecognizer faceRecognizer; 32 | private ProgressDialog progressDialog; 33 | // private JavaCVCamshift javaCVCamshift; 34 | private String name = ""; 35 | Handler handler=new Handler(){ 36 | @Override 37 | public void handleMessage(Message msg) { 38 | super.handleMessage(msg); 39 | switch (msg.what) { 40 | case LOAD_OVER: 41 | progressDialog.dismiss(); 42 | break; 43 | } 44 | } 45 | }; 46 | 47 | 48 | public FaceView(Context context) { 49 | super(context); 50 | try { 51 | progressDialog = new ProgressDialog(context); 52 | progressDialog.setMessage("正在加载分类器"); 53 | progressDialog.show(); 54 | this.faceRecognizer = new FaceRecognizer(context,handler); 55 | // javaCVCamshift = new JavaCVCamshift(); 56 | } catch (IOException e) { 57 | Log.e("faceRecognizer", "Error during facerecognizer initialization", e); 58 | ToastHelper.notify(context, "Error during faceRecognizer initialization"); 59 | } 60 | 61 | } 62 | 63 | //preview每一帧的回调 64 | public void onPreviewFrame(final byte[] data, final Camera camera) { 65 | try { 66 | //获取回调的一帧,放到识别器里识别 67 | Camera.Size size = camera.getParameters().getPreviewSize(); 68 | name = faceRecognizer.processImage(data, size.width, size.height); 69 | if (faceRecognizer.getFaces()!=null&&faceRecognizer.getFaces().total()>0) { 70 | CvRect selection = new CvRect(cvGetSeqElem(faceRecognizer.getFaces(), 0)); 71 | // javaCVCamshift.processImage(selection, data, size.width, size.height); 72 | } 73 | camera.addCallbackBuffer(data); 74 | postInvalidate(); 75 | 76 | 77 | } catch (RuntimeException e) { 78 | // The camera has probably just been released, ignore. 79 | } 80 | } 81 | 82 | 83 | @Override 84 | protected void onDraw(Canvas canvas) { 85 | Paint paint = new Paint(); 86 | paint.setColor(Color.RED); 87 | paint.setTextSize(40); 88 | if (!name.equals("")) { 89 | String s = "识别出身份为:" + name; 90 | float textWidth = paint.measureText(s); 91 | canvas.drawText(s, (getWidth() - textWidth) / 2, 60, paint); 92 | } 93 | if (faceRecognizer.getFaces() != null) { 94 | paint.setStrokeWidth(2); 95 | paint.setStyle(Paint.Style.STROKE); 96 | float scaleX = faceRecognizer.getScaleX(getWidth()); 97 | float scaleY = faceRecognizer.getScaleY(getHeight()); 98 | int total = faceRecognizer.getFaces().total(); 99 | for (int i = 0; i < total; i++) { 100 | CvRect r = new CvRect(cvGetSeqElem(faceRecognizer.getFaces(), i)); 101 | int x = r.x(), y = r.y(), w = r.width(), h = r.height(); 102 | if (getWidth() - x * scaleX < getWidth() - (x + w) * scaleX) { 103 | canvas.drawRect(getWidth() - x * scaleX, y * scaleY, getWidth() - (x + w) * scaleX, (y + h) * scaleY, paint); 104 | } else { 105 | canvas.drawRect(getWidth() - (x + w) * scaleX, y * scaleY, getWidth() - x * scaleX, (y + h) * scaleY, paint); 106 | } 107 | } 108 | } 109 | // if (javaCVCamshift.getTrack_window() != null) { 110 | // CvRect r = javaCVCamshift.getTrack_window(); 111 | // float scaleX = faceRecognizer.getScaleX(getWidth()); 112 | // float scaleY = faceRecognizer.getScaleY(getHeight()); 113 | // int x = r.x(), y = r.y(), w = r.width(), h = r.height(); 114 | // if (getWidth() - x * scaleX < getWidth() - (x + w) * scaleX) { 115 | // canvas.drawRect(getWidth() - x * scaleX, y * scaleY, getWidth() - (x + w) * scaleX, (y + h) * scaleY, paint); 116 | // } else { 117 | // canvas.drawRect(getWidth() - (x + w) * scaleX, y * scaleY, getWidth() - x * scaleX, (y + h) * scaleY, paint); 118 | // } 119 | // } 120 | } 121 | } -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/ImageUtilities.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition; 2 | 3 | import android.*; 4 | import android.R; 5 | import com.googlecode.javacv.cpp.opencv_core; 6 | 7 | /** 8 | * User: piotrplaneta 9 | * Date: 20.01.2013 10 | * Time: 20:55 11 | */ 12 | public class ImageUtilities { 13 | 14 | public static void getResizedFragment(opencv_core.CvRect rect) { 15 | float aspectRatio = (float) (4.0 / 3.0); 16 | 17 | float h = rect.width() / aspectRatio; 18 | if (rect.height() > h) { 19 | float w = rect.height() * aspectRatio; 20 | float diff = w - rect.width(); 21 | 22 | rect.width(Math.round(w)); 23 | rect.x(rect.x() - Math.round(diff/2)); 24 | } else { 25 | float diff = h - rect.height(); 26 | rect.height(Math.round(h)); 27 | rect.y(rect.y() - Math.round(diff/2)); 28 | } 29 | } 30 | 31 | public static boolean isRegionValid(opencv_core.CvRect region, int imageWidth, int imageHeight) { 32 | if (region.x() < 0 || region.y() < 0) { 33 | return false; 34 | } 35 | 36 | if (region.x() + region.width() > imageWidth || region.y() + region.height() > imageHeight) { 37 | return false; 38 | } 39 | return true; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/MainActivity.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition; 2 | 3 | import android.app.Activity; 4 | import android.app.AlertDialog; 5 | import android.content.Intent; 6 | import android.os.Bundle; 7 | import android.os.Environment; 8 | import android.view.View; 9 | import android.view.Window; 10 | import android.view.WindowManager; 11 | import android.widget.FrameLayout; 12 | 13 | import java.io.File; 14 | 15 | // ---------------------------------------------------------------------- 16 | 17 | public class MainActivity extends Activity { 18 | private FrameLayout layout; 19 | private FaceView faceView; 20 | private Preview preview; 21 | private static final int CAMERA_PIC_REQUEST = 1337; 22 | private File storageDir; 23 | 24 | @Override 25 | protected void onCreate(Bundle savedInstanceState) { 26 | super.onCreate(savedInstanceState); 27 | 28 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); 29 | requestWindowFeature(Window.FEATURE_NO_TITLE); 30 | createDirectories(); 31 | } 32 | 33 | private void createDirectories() { 34 | File folder = new File(Environment.getExternalStorageDirectory() + "/faceRecognizer/"); 35 | if (!folder.exists()) { 36 | folder.mkdir(); 37 | } 38 | folder = new File(Environment.getExternalStorageDirectory() + "/faceRecognizerTest/"); 39 | if (!folder.exists()) { 40 | folder.mkdir(); 41 | } 42 | } 43 | 44 | @Override 45 | protected void onStart() { 46 | super.onStart(); 47 | setContentView(R.layout.activity_main); 48 | 49 | } 50 | 51 | public void takePhoto(View view) { 52 | Intent intent = new Intent(this, PersonActivity.class); 53 | startActivity(intent); 54 | } 55 | 56 | 57 | 58 | public void startCamera(View view) { 59 | 60 | // Create our Preview view and set it as the content of our activity. 61 | try { 62 | layout = new FrameLayout(this); 63 | faceView = new FaceView(this); 64 | preview = new Preview(this, faceView); 65 | layout.addView(preview); 66 | layout.addView(faceView); 67 | setContentView(layout); 68 | } catch (Exception e) { 69 | e.printStackTrace(); 70 | new AlertDialog.Builder(this).setMessage(e.getMessage()).create().show(); 71 | } 72 | } 73 | 74 | public void stopPreview() { 75 | preview.stopPreview(); 76 | } 77 | 78 | public void startPreview() { 79 | preview.startPreview(); 80 | } 81 | 82 | // public void setEmail(View view) { 83 | // startActivity(new Intent(this, SetEmail.class)); 84 | // } 85 | 86 | } -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/PersonActivity.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.text.SimpleDateFormat; 6 | import java.util.Date; 7 | 8 | import android.net.Uri; 9 | import android.os.Bundle; 10 | import android.os.Environment; 11 | import android.provider.MediaStore; 12 | import android.app.Activity; 13 | import android.content.Intent; 14 | import android.util.Log; 15 | import android.view.View; 16 | import android.widget.Button; 17 | import android.widget.EditText; 18 | 19 | public class PersonActivity extends Activity { 20 | 21 | private static int counter = -1; 22 | private static String personName; 23 | private static final int CAMERA_PIC_REQUEST = 1337; 24 | private static final int CROP_REQ = 1333; 25 | private File storageDir; 26 | private static File[] takenPhotoFiles = new File[3]; 27 | private static int restore = 0; 28 | private static Button back; 29 | private static Button save; 30 | private static EditText field; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | setContentView(R.layout.person_activity); 36 | 37 | back = (Button)findViewById(R.id.buttonBack); 38 | back.setEnabled(false); 39 | save = (Button)findViewById(R.id.buttonTwo); 40 | 41 | field = (EditText)findViewById(R.id.personEditText); 42 | 43 | } 44 | 45 | @Override 46 | protected void onStart() { 47 | super.onStart(); 48 | //setContentView(R.layout.person_activity2); 49 | 50 | 51 | storageDir = new File( 52 | Environment.getExternalStorageDirectory(), "faceRecognizer" 53 | ); 54 | 55 | } 56 | 57 | public void smile() { 58 | Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 59 | 60 | try { 61 | 62 | counter = counter + 1; 63 | 64 | 65 | takenPhotoFiles[counter] = createImageFile(); 66 | 67 | 68 | System.out.println("Counter ====> " + counter); 69 | Log.i("faceRecognizer", String.valueOf(counter)); 70 | Log.i("faceRecognizer", takenPhotoFiles[counter].getAbsolutePath()); 71 | for (File f : takenPhotoFiles) { 72 | System.out.println("FILE ---> " + f); 73 | } 74 | cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(takenPhotoFiles[counter])); 75 | cameraIntent.putExtra("idx", counter); 76 | 77 | startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); 78 | 79 | System.out.println("Photo Taken!!!"); 80 | 81 | } catch (IOException e) { 82 | System.out.println("Epic fail!"); 83 | e.printStackTrace(); 84 | } 85 | 86 | } 87 | 88 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 89 | if (requestCode == CAMERA_PIC_REQUEST) { 90 | if(resultCode == Activity.RESULT_OK) { 91 | System.out.println("CHECKED!"); 92 | 93 | //System.out.println("EXTRA! " + data.getStringExtra("idx")); 94 | 95 | Log.i("faceRecognizer", takenPhotoFiles.toString()); 96 | Intent intent = new Intent("com.android.camera.action.CROP"); 97 | //System.out.println(.getAbsolutePath()); 98 | intent.setDataAndType(Uri.fromFile(takenPhotoFiles[restore]), "image/*"); 99 | intent.putExtra("crop", "true"); 100 | // this defines the aspect ration 101 | intent.putExtra("aspectX", 4); 102 | intent.putExtra("aspectY", 3); 103 | // this defines the output bitmap size 104 | intent.putExtra("outputX", 200); 105 | intent.putExtra("outputY", 150); 106 | // true to return a Bitmap, false to directly save the cropped iamge 107 | intent.putExtra("return-data", false); 108 | //save output image in uri 109 | intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(takenPhotoFiles[restore])); 110 | startActivity(intent); 111 | restore += 1; 112 | 113 | System.out.println("[RESTORE] " + restore); 114 | if (restore > 2) { 115 | back.setEnabled(true); 116 | save.setEnabled(false); 117 | field.setEnabled(false); 118 | counter = -1; 119 | takenPhotoFiles = new File[3]; 120 | restore = 0; 121 | } 122 | 123 | } else { 124 | takenPhotoFiles[counter].delete(); 125 | counter = -1; 126 | takenPhotoFiles = new File[3]; 127 | restore = 0; 128 | } 129 | } else { 130 | 131 | System.out.println("Hello:)"); 132 | } 133 | } 134 | 135 | public void savePerson(View view) { 136 | EditText editText = (EditText) findViewById(R.id.personEditText); 137 | String message = editText.getText().toString(); 138 | personName = message; 139 | 140 | for (int i=0; i<3; i++) { 141 | smile(); 142 | } 143 | } 144 | 145 | public void backToMenu(View view) { 146 | this.finish(); 147 | } 148 | 149 | @Override 150 | protected void onDestroy() { 151 | super.onDestroy(); 152 | Log.i("faceRecognizer", "ondestoroy"); 153 | } 154 | 155 | private File createImageFile() throws IOException { 156 | // Create an image file name 157 | String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); 158 | String imageFileName = personName + "-" + timeStamp; 159 | File image = File.createTempFile( 160 | imageFileName, 161 | ".jpg", 162 | storageDir 163 | ); 164 | String mCurrentPhotoPath = image.getAbsolutePath(); 165 | System.out.println("path: " + mCurrentPhotoPath); 166 | return image; 167 | } 168 | } -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/Preview.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition; 2 | 3 | import android.content.Context; 4 | import android.graphics.ImageFormat; 5 | import android.hardware.Camera; 6 | import android.view.SurfaceHolder; 7 | import android.view.SurfaceView; 8 | 9 | import java.io.IOException; 10 | import java.util.List; 11 | 12 | /** 13 | * User: piotrplaneta 14 | * Date: 21.01.2013 15 | * Time: 20:27 16 | */ 17 | class Preview extends SurfaceView implements SurfaceHolder.Callback { 18 | SurfaceHolder mHolder; 19 | Camera mCamera; 20 | Camera.PreviewCallback previewCallback; 21 | 22 | public void stopPreview() { 23 | if(this.mCamera != null) { 24 | this.mCamera.stopPreview(); 25 | } 26 | } 27 | 28 | public void startPreview() { 29 | if(this.mCamera != null) { 30 | this.mCamera.startPreview(); 31 | } 32 | 33 | } 34 | 35 | Preview(Context context, Camera.PreviewCallback previewCallback) { 36 | super(context); 37 | this.previewCallback = previewCallback; 38 | 39 | // Install a SurfaceHolder.Callback so we get notified when the 40 | // underlying surface is created and destroyed. 41 | mHolder = getHolder(); 42 | mHolder.addCallback(this); 43 | } 44 | 45 | public void surfaceCreated(SurfaceHolder holder) { 46 | mCamera = Camera.open(Camera.getNumberOfCameras()-1); 47 | try { 48 | mCamera.setPreviewDisplay(holder); 49 | } catch (IOException exception) { 50 | mCamera.release(); 51 | mCamera = null; 52 | } 53 | } 54 | 55 | public void surfaceDestroyed(SurfaceHolder holder) { 56 | mCamera.stopPreview(); 57 | mCamera.release(); 58 | mCamera = null; 59 | } 60 | 61 | 62 | private Camera.Size getOptimalPreviewSize(List sizes, int w, int h) { 63 | final double ASPECT_TOLERANCE = 0.05; 64 | double targetRatio = (double) w / h; 65 | if (sizes == null) return null; 66 | 67 | Camera.Size optimalSize = null; 68 | double minDiff = Double.MAX_VALUE; 69 | 70 | int targetHeight = h; 71 | 72 | // Try to find an size match aspect ratio and size 73 | for (Camera.Size size : sizes) { 74 | double ratio = (double) size.width / size.height; 75 | if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE) continue; 76 | if (Math.abs(size.height - targetHeight) < minDiff) { 77 | optimalSize = size; 78 | minDiff = Math.abs(size.height - targetHeight); 79 | } 80 | } 81 | 82 | // Cannot find the one match the aspect ratio, ignore the requirement 83 | if (optimalSize == null) { 84 | minDiff = Double.MAX_VALUE; 85 | for (Camera.Size size : sizes) { 86 | if (Math.abs(size.height - targetHeight) < minDiff) { 87 | optimalSize = size; 88 | minDiff = Math.abs(size.height - targetHeight); 89 | } 90 | } 91 | } 92 | return optimalSize; 93 | } 94 | 95 | public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { 96 | Camera.Parameters parameters = mCamera.getParameters(); 97 | 98 | List sizes = parameters.getSupportedPreviewSizes(); 99 | Camera.Size optimalSize = getOptimalPreviewSize(sizes, w, h); 100 | parameters.setPreviewSize(optimalSize.width, optimalSize.height); 101 | 102 | mCamera.setParameters(parameters); 103 | mCamera.setDisplayOrientation(0); 104 | if (previewCallback != null) { 105 | mCamera.setPreviewCallbackWithBuffer(previewCallback); 106 | Camera.Size size = parameters.getPreviewSize(); 107 | byte[] data = new byte[size.width*size.height* 108 | ImageFormat.getBitsPerPixel(parameters.getPreviewFormat())/8]; 109 | mCamera.addCallbackBuffer(data); 110 | } 111 | mCamera.startPreview(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/utilities/AppPreferences.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition.utilities; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | 7 | /** 8 | * User: piotrplaneta 9 | * Date: 16.01.2013 10 | * Time: 00:07 11 | */ 12 | public class AppPreferences { 13 | private static final String APP_SHARED_PREFS = "edu.uj.faceRecognizer.faceRecognition_preferences"; 14 | private SharedPreferences appSharedPrefs; 15 | private SharedPreferences.Editor prefsEditor; 16 | 17 | public AppPreferences(Context context) 18 | { 19 | this.appSharedPrefs = context.getSharedPreferences(APP_SHARED_PREFS, Activity.MODE_WORLD_READABLE); 20 | this.prefsEditor = appSharedPrefs.edit(); 21 | } 22 | 23 | public String getEmail() { 24 | return appSharedPrefs.getString("email", "none"); 25 | } 26 | 27 | public void setEmail(String email) { 28 | prefsEditor.putString("email", email); 29 | prefsEditor.commit(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /faceRecognizer/src/main/java/edu/uj/faceRecognizer/faceRecognition/utilities/ToastHelper.java: -------------------------------------------------------------------------------- 1 | package edu.uj.faceRecognizer.faceRecognition.utilities; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | import android.widget.Toast; 6 | 7 | /** 8 | * User: piotrplaneta 9 | * Date: 21.01.2013 10 | * Time: 22:15 11 | */ 12 | public class ToastHelper { 13 | private static String lastMessage=""; 14 | 15 | private static int sameMessageCounter = 0; 16 | private static int differentMessageCounter = 0; 17 | private static Toast lastToast = null; 18 | 19 | public static void notify(Context context, String message) { 20 | if(message != lastMessage) { 21 | if (differentMessageCounter % 5 == 0) { 22 | lastToast = Toast.makeText(context, message, Toast.LENGTH_SHORT); 23 | //lastToast.show(); 24 | } 25 | } else { 26 | if(sameMessageCounter++ % 10 == 0) { 27 | lastToast = Toast.makeText(context, message, Toast.LENGTH_SHORT); 28 | //lastToast.show(); 29 | } 30 | } 31 | 32 | Log.i("faceRecognizer", message); 33 | lastMessage = message; 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libavcodec.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libavcodec.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libavdevice.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libavdevice.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libavfilter.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libavfilter.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libavformat.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libavformat.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libavutil.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libavutil.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniARToolKitPlus.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniARToolKitPlus.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavcodec.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavcodec.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavdevice.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavdevice.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavfilter.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavfilter.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavformat.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavformat.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavutil.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniavutil.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjnicvkernels.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjnicvkernels.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_calib3d.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_calib3d.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_contrib.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_contrib.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_core.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_core.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_features2d.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_features2d.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_flann.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_flann.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_highgui.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_highgui.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_imgproc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_imgproc.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_legacy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_legacy.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_ml.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_ml.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_nonfree.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_nonfree.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_objdetect.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_objdetect.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_photo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_photo.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_stitching.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_stitching.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_video.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_video.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_videostab.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniopencv_videostab.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjnipostproc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjnipostproc.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniswresample.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniswresample.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniswscale.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libjniswscale.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_calib3d.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_calib3d.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_contrib.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_contrib.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_core.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_core.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_features2d.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_features2d.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_flann.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_flann.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_highgui.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_highgui.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_imgproc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_imgproc.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_legacy.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_legacy.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_ml.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_ml.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_nonfree.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_nonfree.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_objdetect.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_objdetect.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_photo.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_photo.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_stitching.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_stitching.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_ts.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_ts.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_video.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_video.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_videostab.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libopencv_videostab.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libpostproc.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libpostproc.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libswresample.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libswresample.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/jniLibs/armeabi-v7a/libswscale.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/jniLibs/armeabi-v7a/libswscale.so -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable-ldpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable-ldpi/ic_launcher.png -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable/Thumbs.db -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable/face.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable/face.bmp -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/drawable/ja.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TokenYc/FaceRecognizer/5f6e6b8d02d5f963c07989eb6c4fcaba5bab1d2e/faceRecognizer/src/main/res/drawable/ja.png -------------------------------------------------------------------------------- /faceRecognizer/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 17 | 18 |