18

I'm trying to get a the Euler angle of a Face that is detected by FaceDetector.

Here is what I use to output to Logcat:

Log.v("debug", " X: " + face.pose(Face.EULER_X) + " Y: " + face.pose(Face.EULER_Y) + " Z: " + face.pose(Face.EULER_Z) );

But it always returns 0.0 for all three, no matter what angle the face is at. Any ideas why?

AakashM
  • 59,217
  • 16
  • 147
  • 181
mellowg
  • 1,736
  • 3
  • 15
  • 19

3 Answers3

5

Yeah the FaceDetector from API 1 never returns a pose angle. You can look at the source code to verify.

The newer FaceDetectionListener from API 14 will return a pose angle, but it's only available on a limited number of devices right now. Not even all devices running API 14 can use it. You have to call getMaxNumDetectedFaces() to see if your device supports that API.

You can alternately try using OpenCV. A couple options for that are http://code.opencv.org/projects/opencv/wiki/OpenCV4Android and http://code.google.com/p/javacv/. In my experience they aren't worth the hassle unless you really, really need the pose angle.

Christian
  • 1,810
  • 15
  • 26
  • Can I use the FaceDetectionListener to do something simple like detecting faces on the Bitmap (nothing to do with Camera)? And without the pose angle, is there a way for FaceDectector to check for both eyes positions (seems like impossible)? – Lim Thye Chean Jul 26 '14 at 08:27
0

There are a few similar questions here. Check out the first answer from this link:

Android Facedetector pose values are always 0

And see below for someone that says they solved the problem:

Android Face Detection

Community
  • 1
  • 1
Nick
  • 3,738
  • 33
  • 53
0

Set the detector setMode to ACCURATE_MODE

Here is an example that worked for me in Kotlin:

val detector = FaceDetector.Builder(context)
            .setClassificationType(FaceDetector.ACCURATE_MODE)
            .setMode(FaceDetector.ACCURATE_MODE)
            .setTrackingEnabled(true)
            .build()
Andre
  • 24,160
  • 6
  • 28
  • 67
Orelvis Lago
  • 51
  • 1
  • 5
  • This question concerned the FaceDetector in API level 1: https://developer.android.com/reference/android/media/FaceDetector.html – Jonathan Ellis Apr 09 '19 at 15:54