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.