Camera face detection getMaxNumDetectedFaces returns 0 for Nexus 4, Nexus 7, Samsung Galaxy 2

StackOverflow https://stackoverflow.com/questions/19611062

  •  01-07-2022
  •  | 
  •  

Pergunta

I'm trying to get face detection working in live preview mode using the hardware-based Camera.faceDetectionListener new in ICS. I have tried with Nexus 4, Nexus 7, and a Samsung Galaxy 10.1 tablet and ALL of these devices return 0 for the front camera when I call getMaxNumDetectedFaces. All of the devices support face unlock, though, so I don't understand why none of them seem to support face detection. Has anyone got this working with one of these devices?

Foi útil?

Solução

Supported starting with API 14 (ICS), getMaxNumDetectedFaces returns the max length of the array that contains the results of camera face detection after it is started with startFaceDetection. If the value returned is 0, it indicates that the device does not support this method of face detection. In this case, face detection must be implemented by some other means (e.g., using FaceDetector available since API 1).

I checked the value returned by getMaxNumDetectedFaces for both front and back cameras in a few devices:

  • Nexus 4: returns 2 for both cameras.
  • Nexus 5: returns a very large number (5308421) for both cameras.
  • Nexus 7: returns 0 for both cameras.
  • Nexus 10: returns 16 for both cameras
  • Sony Xperia Z1: returns 5 for both cameras.

In summary, OEM support for camera face detection is hit and miss.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top