I have the following code and i want to automatic take only one photo when a face is detected. I have achieve to automatic take photo but it takes many photos without time to process them because it continuously detect the face. How can i make it to search every x minutes to find a face or every x minutes to take photo? Thank you in advance.
FaceDetectionListener faceDetectionListener
= new FaceDetectionListener(){
@Override
public void onFaceDetection(Face[] faces, Camera camera) {
if (faces.length == 0){
prompt.setText(" No Face Detected! ");
}else{
//prompt.setText(String.valueOf(faces.length) + " Face Detected :) ");
try{
camera.takePicture(myShutterCallback,myPictureCallback_RAW, myPictureCallback_JPG);
}
catch(Exception e){
}
}
}};