// Path: magicalcamera/src/main/java/com/frosquivel/magicalcamera/Objects/FaceRecognitionObject.java
// public class FaceRecognitionObject {
//     //Getters and Setters method
//     public List<Landmark> listLandMarkPhoto;
// 
//     public List<Landmark> getListLandMarkPhoto() {
//         return listLandMarkPhoto;
//     }
// 
//     public void setListLandMarkPhoto(List<Landmark> listLandMarkPhoto) {
//         this.listLandMarkPhoto = listLandMarkPhoto;
//     }
// }


import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
import android.util.SparseArray;
import com.frosquivel.magicalcamera.Objects.FaceRecognitionObject;
import com.google.android.gms.vision.Frame;
import com.google.android.gms.vision.face.Face;
import com.google.android.gms.vision.face.FaceDetector;
import static android.graphics.Color.RED;
                .setTrackingEnabled(false)
                .build();
            try {
                if (false == this.detector.isOperational()) {
                    return null;
                }

                //Add the image on a Frame object
                Frame frame = new Frame.Builder()
                        .setBitmap(photo)
                        .build();

                //Detect all faces from Frame object
                SparseArray<Face> faceArray = detector.detect(frame);

                //Do some drawing on faces
                Bitmap outBitmap = drawOnFace(faceArray, photo, stroke, color);

                //Releasing the detector object
                this.detector.release();
                return (outBitmap != null) ? outBitmap : photo;
            }catch(Exception ev){
                return null;
            }
    }


    /**
     * Method to drawing on faces
     */
// Path: magicalcamera/src/main/java/com/frosquivel/magicalcamera/Objects/FaceRecognitionObject.java
// public class FaceRecognitionObject {
//     //Getters and Setters method
//     public List<Landmark> listLandMarkPhoto;
// 
//     public List<Landmark> getListLandMarkPhoto() {
//         return listLandMarkPhoto;
//     }
// 
//     public void setListLandMarkPhoto(List<Landmark> listLandMarkPhoto) {
//         this.listLandMarkPhoto = listLandMarkPhoto;
//     }
// }


// Path: magicalcamera/src/main/java/com/frosquivel/magicalcamera/Functionallities/FaceRecognition.java
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PointF;
import android.graphics.RectF;
import android.util.SparseArray;
import com.frosquivel.magicalcamera.Objects.FaceRecognitionObject;
import com.google.android.gms.vision.Frame;
import com.google.android.gms.vision.face.Face;
import com.google.android.gms.vision.face.FaceDetector;
import static android.graphics.Color.RED;

                .setTrackingEnabled(false)
                .build();
            try {
                if (false == this.detector.isOperational()) {
                    return null;
                }

                //Add the image on a Frame object
                Frame frame = new Frame.Builder()
                        .setBitmap(photo)
                        .build();

                //Detect all faces from Frame object
                SparseArray<Face> faceArray = detector.detect(frame);

                //Do some drawing on faces
                Bitmap outBitmap = drawOnFace(faceArray, photo, stroke, color);

                //Releasing the detector object
                this.detector.release();
                return (outBitmap != null) ? outBitmap : photo;
            }catch(Exception ev){
                return null;
            }
    }


    /**
     * Method to drawing on faces
     */
    private Bitmap drawOnFace(SparseArray<Face> faceArray, Bitmap photo, int stroke, int color){