Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to listen if face is detected ? #14

Open
monikkacha opened this issue Dec 25, 2020 · 1 comment
Open

how to listen if face is detected ? #14

monikkacha opened this issue Dec 25, 2020 · 1 comment

Comments

@monikkacha
Copy link

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

@CMingTseng
Copy link

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

    val faceBounds = faces.map { face -> face.toFaceBounds(this) }

add "onFaceDetectionResultListener?.onSuccess(faceBounds)"

  1. modify demo MainActivity.kt line 44 & 45

    val faceDetector = FaceDetector(faceBoundsOverlay)

add

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

        }
    })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants