Open vidurajith-darshana opened 8 months ago
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: Same issue is reproduced in your example too
iOS 16.5.1 (20F75) iPad (5th generation) (Model A1822)
@vidurajith-darshana
I've never used firebase in my app and if there are any additional installation guides will be really helpful 🙏🏼.
you can setup firebase with https://rnfirebase.io/ if you are using expo here is how https://docs.expo.dev/guides/using-firebase/#using-react-native-firebase Do not use the Firebase JS SDK
@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
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: Same issue is reproduced in your example too
iOS 16.5.1 (20F75) iPad (5th generation) (Model A1822)
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 “ABA4B2D6-A241-4DF6-A1BA-FD6F984A2EE3-1864-0000024DF9AE4C71.jpg” couldn’t be opened because there is no such file."
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 vision-camera-face-detection
not here.
No it's still not working
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 file:///private/blah
when working with local file it returns correct result. file path from photo library file:///var/mobile
[{"frame": {"height": 1206, "left": 530, "top": 968, "width": 1206}, "rotationX": -5.255302906036377, "rotationY": -3.0993707180023193, "rotationZ": -1.612923502922058}] faces
p/s: on IOS
I had similar issue with another library https://github.com/teslamotors/react-native-camera-kit/issues/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.
Create a patch file (lookup react native patch if you are not familiar with this) patches/@react-native-ml-kit+face-detection+1.3.1.patch
Paste these file contents
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
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];
MLKVisionImage visionImage = [[MLKVisionImage alloc] initWithImage:image]; MLKFaceDetectorOptions options = [self getOptions:optionsDict]; MLKFaceDetector *faceDetector = [MLKFaceDetector faceDetectorWithOptions:options];
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.