Search code examples
javaandroidface-detection

Android FaceDetector always returns number of detected faces equals 0


Android 4.2, Windows emulator with Intel acceleration.

I using this code and with different pictures always no face detection:

BitmapFactory.Options BitmapFactoryOptionsbfo = new BitmapFactory.Options();
BitmapFactoryOptionsbfo.inPreferredConfig = Bitmap.Config.RGB_565; 
myBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.face5,       BitmapFactoryOptionsbfo);
imageWidth = myBitmap.getWidth();
imageHeight = myBitmap.getHeight();
myFace = new FaceDetector.Face[numberOfFace];
myFaceDetect = new FaceDetector(imageWidth, imageHeight, numberOfFace);
numberOfFaceDetected = myFaceDetect.findFaces(myBitmap, myFace);     

What problem is it?


Solution

  • This example did the same as you did:

    http://trivedihardik.wordpress.com/2011/09/13/android-face-detection-example/

    Another link to try:

    http://www.developer.com/ws/android/programming/face-detection-with-android-apis.html