luicfrr / react-native-vision-camera-face-detector

Vision Camera Frame Processor Plugin to detect faces using MLKit Face Detector
https://www.npmjs.com/package/react-native-vision-camera-face-detector
MIT License
117 stars 21 forks source link

[BUG 🐛] Mirroring makes detection of yaw faulty #106

Open levepic opened 19 hours ago

levepic commented 19 hours ago

When detecting yawAngle of a face, the face seems to be mirrored on ios (or at least on some ios devices) while it is not mirrored on android (or at least some android devices). So when you try to detect "turn head left" its the opposite angle on ios and android! Im not sure if platform detection solves the problem or there are more differences between devices. Any ideas, suggestions?

"react-native-vision-camera": "^4.5.3",
"react-native-vision-camera-face-detector": "^1.7.1",
"react-native-worklets-core": "^1.3.3",
lattaai1 commented 19 hours ago

Hello, I've fixed this issue!

This is what I've done: I have identified the issue with the yawAngle being mirrored on iOS. The problem lies in the VisionCameraFaceDetector.swift file. To solve this, I've made a modification to the callback function to invert the yawAngle for iOS devices. This should ensure consistent behavior across both iOS and Android platforms.

I also created pull request: https://github.com/luicfrr/react-native-vision-camera-face-detector/pull/107

[!CAUTION]
Disclaimer: This fix was created by Latta AI and you should never merge before you check the correctness of generated code!


This bug was fixed for free by Latta AI - https://latta.ai/ourmission