Android Open Source - AndroidFaceRecognizer Detection Based Tracker






From Project

Back to project page AndroidFaceRecognizer.

License

The source code is released under:

MIT License

If you think the Android project AndroidFaceRecognizer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.yaylas.sytech.facerecognizer;
/*w ww  . ja va2  s.  co m*/
import java.util.Vector;

import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;

import android.widget.Toast;

public class DetectionBasedTracker
{
    public DetectionBasedTracker(String cascadeName, int minFaceSize, boolean isFaceDetector) {
        mNativeObj = nativeCreateObject(cascadeName, minFaceSize, isFaceDetector);
    }

    public long getNativeObj(){
      return mNativeObj;
    }

    public void setMinFaceSize(int size) {
        nativeSetFaceSize(mNativeObj, size);
    }

    public void detect(Mat imageGray, MatOfRect faces) {
        nativeDetect(mNativeObj, imageGray.getNativeObjAddr(), faces.getNativeObjAddr());
    }

    public void release() {
        nativeDestroyObject(mNativeObj);
        mNativeObj = 0;
    }
    public static Vector<Mat> imageVector = new Vector<Mat>();
    public static void addElement(Mat m){
      imageVector.add(m);
      System.out.println("--------------------------------- elementAdded: "+imageVector.size());
    }
    
    public static long getElementAt(int index){
      if(index >= imageVector.size() || index < 0){
        return 0;
      }
      
      System.out.println("-------------------------***** get element: "+imageVector.size()+"  index: "+index);
      return imageVector.elementAt(index).getNativeObjAddr();
    }
    
    public static int getImageCount(){
      return imageVector.size();
    }
    

    private long mNativeObj = 0;

    private static native long nativeCreateObject(String cascadeName, int minFaceSize, boolean faceDetection);
    private static native void nativeDestroyObject(long thiz);
    private static native void nativeStart(long thiz);
    private static native void nativeStop(long thiz);
    private static native void nativeSetFaceSize(long thiz, int size);
    private static native void nativeDetect(long thiz, long inputImage, long faces);
    
}




Java Source Code List

com.yaylas.sytech.facerecognizer.DetectionBasedTracker.java
com.yaylas.sytech.facerecognizer.EditDatabaseActivity.java
com.yaylas.sytech.facerecognizer.FaceDetectionActivity.java
com.yaylas.sytech.facerecognizer.FaceRecognitionActivity.java
com.yaylas.sytech.facerecognizer.MainPageActivity.java
com.yaylas.sytech.facerecognizer.SplashActivity.java
com.yaylas.sytech.facerecognizer.facedatabase.FaceRecognizerDBHelper.java
com.yaylas.sytech.facerecognizer.facedatabase.FacesDataSource.java
com.yaylas.sytech.facerecognizer.facedatabase.Person.java
com.yaylas.sytech.facerecognizer.methods.FaceDetection.java
com.yaylas.sytech.facerecognizer.utils.FaceDetectionUtils.java
com.yaylas.sytech.facerecognizer.utils.ImageUtils.java