Android FaceDetector.Face Euler angles are 0 all the time

折月煮酒 提交于 2019-11-29 16:50:38

问题


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?


回答1:


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.




回答2:


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




回答3:


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()


来源:https://stackoverflow.com/questions/5960563/android-facedetector-face-euler-angles-are-0-all-the-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!