-
Notifications
You must be signed in to change notification settings - Fork 756
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
Face detection not working on front camera (iOS) #570
Comments
EDIT: it's actually working sometimes. On the UI of the front camera, there is little button to do a little zoom in/out. If I take the picture with the zoom out the faces are detected, if the camera has that little zoom in (which is the default setting), it doesn't work |
For face recognition, you should use an image with dimensions of at least 480x360 pixels. For ML Kit to accurately detect faces, input images must contain faces that are represented by sufficient pixel data. In general, each face you want to detect in an image should be at least 100x100 pixels. |
When the front camera is in zoom-in mode, the picture has a dimension of 2316×3088, and my face is NOT detected. When the camera is in zoom-out mode, the picture has a dimension of 3024×4032, and my face is detected. |
have you found solution for this one besides zooming out everytime? since the zooming out make the process stuck @giordy16 |
no |
This issue is stale because it has been open for 30 days with no activity. |
So I have narrowed down the issue to these points:
Overall this issue is related with File Path in iOS, maybe the library is not able to load the UIImage in Swift code when the image path is given from the captured image using camera plugin, but it is able to load the UIImage when the image path is given from Photos App |
@fbernaly can you remove the stale label from this issue and look into this issue? |
@TecHaxter : I have removed the stale label, but I do not have bandwidth to work on this. Feel free to fork the repo and submit your contribution. I will review your PR ASAP and release a new version ASAP. |
try this `Future getImageAndDetectFaces(XFile imageFile) async {
} processPickedFile(XFile pickedFile) async {
} Future<File?> bakeImageOrientation(XFile pickedFile) async {
}` Dont forget import this import 'package:image/image.dart' as imglib; |
Thanks. It's working to me. |
Thank you, this does work for me |
Thank you, This works on the IOS @itzmail InputImage inputImage; List faces = await faceDetector.processImage(inputImage); |
Thanks @itzmail this worked like a magi, made it very smooth without stress to detect image
|
The above solution has been incredibly helpful in resolving the zoomed-in Front Camera selfie issue on iOS devices and improving overall face detection accuracy. I've implemented this approach with some modifications to fit my specific use case, and I wanted to share how it benefited my project in case it helps others:
Here's a snippet of how I achieved this: Future<XFile> _processIOSImage(XFile pickedFile) async {
// ... [Same implementation of bakeImageOrientation] ...
}
// In selfie capture
if (Platform.isIOS && byCamera) {
file = await _processIOSImage(file);
}
// In image upload from gallery
if (Platform.isIOS) {
file = await _processIOSImage(file);
} |
Face detection not working on front camera (iOS)
I am using the example app, and when I try to take a picture using my front camera, the faces found is always 0. If use the back camera, everything works.
Steps to reproduce the behavior:
Platform:
The text was updated successfully, but these errors were encountered: