Face Detection is not working in Android with google_ml_kit: ^0.19.0 Dependency
Describe your issue. If applicable, add screenshots to help explain your problem.
This requirement addresses the issue where face detection is not functioning properly on Android when using the google_ml_kit: ^0.19.0 dependency. The solution aims to identify and resolve compatibility problems, bugs, or missing configurations that prevent the face detection feature from working as expected. The goal is to ensure seamless integration of Google ML Kit's face detection capabilities in Android applications, allowing for accurate and efficient face tracking and recognition.
Steps to reproduce.
Steps to Reproduce the Face Detection Issue in Android with google_ml_kit: ^0.19.0 Dependency
-
Set Up the Project:
- Create a new Flutter project or open an existing one.
- Add the google_ml_kit: ^0.19.0 dependency in your
pubspec.yamlfile. - Run
flutter pub getto install the dependency.
-
Initialize Camera for Face Detection:
- Implement the camera initialization using Flutter’s camera plugin or native camera integration.
- Add necessary permissions (camera, storage) in
AndroidManifest.xml:<uses-permission android:name="android.permission.CAMERA"/>
-
Implement Face Detection Code:
- Set up the face detection code using
google_ml_kit. For instance, create aFaceDetectorinstance and start the camera preview.
- Set up the face detection code using
-
Build and Run the Application on an Android Device:
- Build the app and run it on a physical Android device (not emulator).
- Make sure you grant all permissions when prompted.
-
Test Face Detection:
- Open the app and ensure the camera is functioning.
- Point the camera at a face to see if face detection works.
-
Observe the Issue:
- Notice that the camera feed displays, but no faces are detected in real-time.
- The live camera preview fails to detect any faces, despite the face being visible and in clear lighting.
- Face landmarks and liveness detection do not work or trigger any events.
-
Verify Logs (Optional):
- Check Android Studio logs for any relevant error messages or warnings related to the ML Kit's face detection, camera initialization, or missing dependencies.
This reproduces the face detection failure using google_ml_kit: ^0.19.0 on Android.
What is the expected result?
Expected Result:
- When the camera is opened, the face detector should automatically start detecting faces in the camera feed.
- The camera should detect and highlight faces in real-time, showing facial landmarks (such as eyes, nose, and mouth) and tracking movements.
- If implemented, liveness detection should accurately detect whether the face in view is real and not a static image.
Actual Result:
- The camera opens, but face detection does not trigger, and no faces are detected.
- There is no visual indication of facial landmarks or liveness detection, even though the camera feed is visible.
Did you try our example app?
Yes
Is it reproducible in the example app?
Yes
Reproducible in which OS?
Android
Flutter/Dart Version?
[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4317], locale en-US) • Flutter version 3.24.3 on channel stable at C:\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2663184aa7 (5 weeks ago), 2024-09-11 16:27:48 -0500 • Engine revision 36335019a8 • Dart version 3.5.3 • DevTools version 2.37.3
Plugin Version?
dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.8 image: ^4.2.0 file_picker: ^8.1.2 path_provider: ^2.1.4 camera: ^0.10.6 camera_android_camerax: ^0.6.10 google_ml_kit: ^0.19.0 google_mlkit_face_detection: ^0.12.0 fluttertoast: ^8.2.8 flutter_pdfview: ^1.3.3 image_picker: ^1.1.2 tflite_flutter: ^0.11.0
The face is not detected in android device camera
Has anyone faced this issue and solved it? If yes, can you explain how to solve it?
@bensonarafat can you help me
Do you try the example app ? @santhoshAndroid
Yes, I tried, but the camera turns on, and no face is detected @bensonarafat
If any configuration for android gradle files
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
What are the minimum requirements of android device in terms of camera, processor, chipset and OS version can anyone please share details
It's the same thing for me as well. No face is being detected.
camera: ^0.10.5+5 flutter_vision: ^1.1.4 provider: ^6.1.1 http: ^1.1.0 path_provider: ^2.1.1 path: ^1.8.3 image: ^4.1.3 image_picker: ^1.1.2 permission_handler: ^12.0.0+1 google_mlkit_face_detection: ^0.13.1 google_ml_kit: ^0.20.0
and the repo can be found in the following link: https://github.com/ShaysFrame/open_rtms/tree/ml-kit-switch it doesn't detect any faces please someone take a look at the code and let me know if it's possible to fix this issue. : |