Face detection not working using methods from API14

南笙酒味 提交于 2021-01-28 01:48:04

问题


I have a problem with face detection methods from API14. I have not null camera object. I set to it listener using setFaceDetectionListener with very simple implementation of FaceDecectionListener.

I next step I call camera.startFaceDetection() but inteface method onFaceDetection(Face[] faces, Camera camera) is never call... What's wrong with this simple method? Maybe there's a problem with camera? I tested this function on SGS3 and SGS4 and I have the same problem.


回答1:


OK guys, issue solved. Not all devices supports face detection function from camera preview. It's device-dependent. Some of devices can crash with message like java.lang.IllegalArgumentException: invalid face detection type=0 but some devices do nothing and listener's method is never reached.

In this case it's needed to check that device support this function using Camera.getMaxNumDetectedFaces(). If this method returns 0 then we can be sure that our device does not support face detection methods from API14.



来源:https://stackoverflow.com/questions/19011319/face-detection-not-working-using-methods-from-api14

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