Android FaceDetector.Face欧拉角始终为0
我正在尝试获取由 FaceDetector 检测到的面部的欧拉角。
以下是我用来输出到 Logcat 的内容:
Log.v("debug", " X: " + face.pose(Face.EULER_X) + " Y: " + face.pose(Face.EULER_Y) + " Z: " + face.pose(Face.EULER_Z) );
但无论面部处于什么角度,这三个参数始终返回 0.0。有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,API 1 中的 FaceDetector 永远不会返回姿势角度。您可以查看源代码进行验证。
API 14 中较新的 FaceDetectionListener 将返回姿势角度,但是目前仅在有限数量的设备上可用。甚至并非所有运行 API 14 的设备都可以使用它。您必须调用 getMaxNumDetectedFaces()查看您的设备是否支持该 API。
您也可以尝试使用 OpenCV。几个选项是 http://code.opencv.org/projects/opencv/wiki /OpenCV4Android 和 http://code.google.com/p/javacv/。根据我的经验,除非你真的非常需要姿势角度,否则它们不值得麻烦。
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.
这里有几个类似的问题。查看此链接中的第一个答案:
Android FaceDetector 姿势值始终为 0
请参阅下面有人说他们解决了问题:
Android 人脸检测
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
将检测器
setMode
设置为ACCURATE_MODE
下面是一个在 Kotlin 中对我有用的示例:
Set the detector
setMode
toACCURATE_MODE
Here is an example that worked for me in Kotlin:
在最新版本上,开发人员需要将性能模式设置为 PERFORMANCE_MODE_ACCURATE 而不是 PERFORMANCE_MODE_FAST
On the latest version developers needs to set the perfomance mode to PERFORMANCE_MODE_ACCURATE not PERFORMANCE_MODE_FAST