0

I am currently making a face detection app. When I move the camera quickly, non face images are sometimes got from detector.

override fun analyze(imageProxy: ImageProxy) {

    val t1 = System.currentTimeMillis()

    val btm = imageProxy.toBitmap() ?: return
    val image: InputImage = InputImage.fromBitmap(btm, imageProxy.imageInfo.rotationDegrees)
    detectInImage(image)
        .addOnSuccessListener { results ->
                val items = results.mapNotNull {
                    it
                }
                val rotated = btm.rotateBitmap(imageProxy.imageInfo.rotationDegrees)
                rotated?.let {
                    onFacesDetected(items, it)
                    onOutlineDetected(items, Rect(0,0, btm.width, btm.height))
                }
            
            imageProxy.close()
        }
        .addOnFailureListener {
            onFailure(it)
            imageProxy.close()
        }
}

Maybe I have a mistake to config face detector or ImageAnalysis.builder. Who was faced this case in the past and what is the solution? Please help me.

  • It is kind of intended behavior that face detection failed when your image quality is low(e.g moving too fast). Maybe you can try ML Kit face mesh API? https://developers.google.com/ml-kit/vision/face-mesh-detection – jack Aug 17 '23 at 21:09
  • Thanks for your reply. When I move the camera fast, the detector return the face object that it's boundingbox is wrong, I think. I have a look at your profile. It seems that you are very familiar with ML Kit. Thank you very much if you let me know your email address or any other contact. – Shiro Ennosuke Aug 18 '23 at 14:07

0 Answers0