-
Notifications
You must be signed in to change notification settings - Fork 61
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 returns [] #44
Comments
Hi @vidurajith-darshana! Thanks for reporting this issue. I'll check it and get back to you once I have something to share 🙏🏼. |
@a7medev thanks for the reply. Hope some quick solution as soon as possible. we are stuck with this issue. Please note I've never used firebase in my app and if there are any additional installation guides will be really helpful 🙏🏼. |
Hi everyone! I have same issue but only with ios devices and selfie photos made by them. If I download selfie photo from internet it works). I have same issue in react-native-face-detection module too. I use react-native-image-picker module and its methods: launchImageLibrary and launchCamera to get a selfie. If I share problem selfie somewhere and then download it then this selfie works) magic! It looks like ios protects reading images made by its device. Update: iOS 16.5.1 (20F75) |
you can setup firebase with https://rnfirebase.io/ |
@flexbox Actually he asked does he needs to setup Firebase for react-native-ml-kit ? he asked if there were any other installation instructions related to react-native-ml-kit based on Firebase, it's helpful. not about the Firebase setup |
Same on me |
@a7medev is there any update, please? we have been stuck with this issue since last week. |
@vidurajith-darshana have you found some solution? |
no luck, still the same |
after debugging, i think the problem is with the temp file path from vision-camera output. As the photo file is stored in a temporary location, that is not accessible directly by file path. It cannot work with that file path atm. |
it's throwing error like |
seems we don't have an answer here. I've been struggling for weeks here using this library. any PR is welcome for the issues. This is going to be an inactive, not-maintained repo. |
I will try to see if i can open pr. Take a rest :) |
great! but did it give your results as you expected? when I try to get the face detection results, it always returns []. did you have your results correctly? |
hmm sorry, i messed up the lib. i supposed to comment on other issue from |
it does not work with vision-camera. I think there is smt with temp file. It works fine with local photo from library but not with temp file name
p/s: on IOS |
I had similar issue with another library teslamotors/react-native-camera-kit#568 For me, its not to do with file location as suggested but to do with image orientation. Here is how I patched mine so that I can make this work for the react-native-camera-kit library I am using. I could be wrong but I don't think this has to do with the mlkit itself.
index 87fd4ff..f237b71 100644
--- a/node_modules/@react-native-ml-kit/face-detection/ios/FaceDetection.m
+++ b/node_modules/@react-native-ml-kit/face-detection/ios/FaceDetection.m
@@ -234,6 +234,15 @@ - (NSDictionary*)faceToDict: (MLKFace*)face
return dict;
}
+- (UIImage*)fixImageOrientation: (UIImage*)image
+ {
+ UIGraphicsBeginImageContext(image.size);
+ [image drawAtPoint:CGPointZero];
+ UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+ return newImage ?: image;
+}
+
RCT_EXPORT_METHOD(detect: (nonnull NSString*)url
withOptions: (NSDictionary*)optionsDict
resolver:(RCTPromiseResolveBlock)resolve
@@ -241,7 +250,9 @@ - (NSDictionary*)faceToDict: (MLKFace*)face
{
NSURL *_url = [NSURL URLWithString:url];
NSData *imageData = [NSData dataWithContentsOfURL:_url];
- UIImage *image = [UIImage imageWithData:imageData];
+ UIImage *imageraw = [UIImage imageWithData:imageData];
+ UIImage *image = [self fixImageOrientation:imageraw];
+
MLKVisionImage *visionImage = [[MLKVisionImage alloc] initWithImage:image];
MLKFaceDetectorOptions *options = [self getOptions:optionsDict];
MLKFaceDetector *faceDetector = [MLKFaceDetector faceDetectorWithOptions:options]; |
` s.dependency "React"
diff --git a/node_modules/@react-native-ml-kit/face-detection/android/.gitignore b/node_modules/@react-native-ml-kit/face-detection/android/.gitignore -RCT_EXPORT_METHOD(detect: (nonnull NSString*)url
+RCT_EXPORT_METHOD(detect:(NSString * _Nonnull)url
{
+// EXIF 정보를 고려하여 이미지 회전
` It is working just do remove the exif information ... |
Ios device issue any one find solution if so please update |
Hello, I'm facing an issue with my IOS device. When I send an image URL captured through a react-native-vision-camera it returns an empty array. Do you know how I can solve this?
const photo = await camera.current.takePhoto({
enableShutterSound: false,
});
try {
const faceResults = await FaceDetection.detect('file://' + photo.path, {
contourMode: 'all',
});
console.log(faceResults);
} catch (e) {
console.log(e);
}
EX: I didn't use any firebase package.
The text was updated successfully, but these errors were encountered: