Android - Face feature detection

前端 未结 5 1508
南方客
南方客 2021-02-02 16:24

Currently I\'m working on an app for Android phones. We want to detect features of a face. The programm should be able to detect the positions of the eyes, the nose, the mouth a

5条回答
  •  醉话见心
    2021-02-02 17:21

    OpenCV has a tutorial for this purpose, unfortunately is C++ only so you would have to convert it to Android.

    You can also try FaceDetection API in Android, this is a simple example if you are detecting images from a drawable or sdcard images. Or the more recent Camera.Face API which works with the camera image.

    If you want image from your camera at dynamic time than first read How to take picture from camera., but I would recommend you to check the official OpenCV Android samples and use them.

    Updated:

    Mad Hatter Example use the approach of Camera with SurfaceView. Its promisingly fast. Have a look at Mad Hatter.

    The relevant code, in case the link goes down, is this:

    public class FaceDetectionListener implements Camera.FaceDetectionListener {
        @Override
        public final void onFaceDetection(Face[] faces, Camera camera) {
            if (faces.length > 0) {
                for (Face face : faces) {
                    if (face != null) {
                        // do something
                    }
                }
            }
        }
    }
    

提交回复
热议问题