android-face-detector icon indicating copy to clipboard operation
android-face-detector copied to clipboard

how to listen if face is detected ?

Open monikkacha opened this issue 4 years ago • 1 comments

i have implemented lib in my project and followed docs ,

i want to listen if face is detected , i know that there is a on faied result listenter , where i need to pass result listenere which gives me onSuccess and onFailed callback methods , but i am not getting any response , neither success nor failure . i even tried to impalement interface but results are same .

please let me know why does its happening , and thank you if you can help me

monikkacha avatar Dec 25 '20 17:12 monikkacha

Dear Sir

  1. open app build.gradle // implementation "com.github.husaynhakeem:android-face-detector:2.0" // Remote <---close implementation(project(":facedetector")) // Local <---opne

  2. modify FaceDetector.kt at line 94 & 95 https://github.com/husaynhakeem/android-face-detector/blob/a8162ac724d1a439b9e2040c33cd2a1e69ae657a/facedetector/src/main/java/husaynhakeem/io/facedetector/FaceDetector.kt#L94

add "onFaceDetectionResultListener?.onSuccess(faceBounds)"

  1. modify demo MainActivity.kt line 44 & 45

    https://github.com/husaynhakeem/android-face-detector/blob/a8162ac724d1a439b9e2040c33cd2a1e69ae657a/app/src/main/java/husaynhakeem/io/facedetectorapp/MainActivity.kt#L44

add

faceDetector.setonFaceDetectionFailureListener(object : FaceDetector.OnFaceDetectionResultListener { override fun onSuccess(faceBounds: List<FaceBounds>) { Log.e("YOOOOO","Get face $faceBounds ") } override fun onFailure(exception: Exception) {

        }
    })

CMingTseng avatar Oct 21 '22 20:10 CMingTseng