简体   繁体   中英

How to check liveness in face detection in android face detection

I am creating one android app for attendance system, in which I'll capture the pic as soon as I detect the face. I am able to achieve this but with only one issue, this system can be faked with the photo of employee because there is no liveness check right now.

mCamera.setFaceDetectionListener(new Camera.FaceDetectionListener(){
    @Override
    public void onFaceDetection(final Camera.Face[]faces,Camera camera){
        if(faces!=null&&faces.length>0){
            try{
                if(lastCaptureTiume+10000<=System.currentTimeMillis()){

                    mCamera.takePicture(null,null,jpegCallback);
                    lastCaptureTiume=System.currentTimeMillis();
                }
            }
            catch(Exception e)
            {
            }
        }
    });
}

On jpegCallback I am checking the face and cropping it for further process.

I searched for some samples for liveness but no luck, If anybody knows how I can implement liveness please help.

You could take more than one picture in sequence and see whether they change in non-obvious ways (eg no translate or rotate).

The problem is that if you're worried about gaming the system, and it is feasible now to present a picture to the system, nothing would stop someone else to present a tablet or e-book reader, smart enough to display a short animation, to the system.

It might perhaps be more fruitful, if at all possible, to take a full-body picture possibly from a different POV. It all depends on where the android app is running (eg an automatic badge booth). If it's running on the attendee's phone and you want to be sure of his identity, I'm afraid you can't.

With Android version 5 , you might try using a z-scan of the face. Focus rapidly on several planes stepped 5 cm apart in the frustum. If the face is attached to a 3-D skull, you'll "see" a focused area moving concentrically from the nose outwards. Unless you have some attendee with a really flat face. You'll have to do it two or three times focusing at random distances, so that the person can't move apart from the camera to compensate. To estimate focusing, you can try using local variance in the image.

Of course this will restrict the models your app will be compatible with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM