TommyNecessary
TommyNecessary

Reputation: 1377

Face detection not working using methods from API14

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.

Upvotes: 2

Views: 1903

Answers (1)

TommyNecessary
TommyNecessary

Reputation: 1377

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.

Upvotes: 3

Related Questions