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
127 stars 22 forks source link

[BUG šŸ›] The managed implementation works on Android, but on iOS, only the bounding boxes are drawn correctly, while the orientation for drawing landmarks is not accurate. #98

Open shishi-RN opened 2 months ago

shishi-RN commented 2 months ago

Description: The default bounding box for face detection correctly covers the face on iPad, but the landmarks are positioned outside the face and appear rotated by 90 or 270 degrees.

Steps to Reproduce:

Use react-native-vision-camera-face-detector in a React Native project. Run the app on an iPad device. Observe that the bounding box correctly covers the face, but the landmarks are incorrectly positioned and rotated. Expected Behavior: The landmarks should be positioned correctly inside the bounding box and aligned with the facial features.

Actual Behavior: Landmarks are positioned outside the bounding box and appear rotated (by 90 or 270 degrees).

Environment:

React Native: 0.72.X (or your version) iPadOS: (version) react-native-vision-camera: 4.5.0 react-native-vision-camera-face-detector: ^1.7.1 Code Example:

import {StyleSheet, View} from 'react-native'; import React from 'react'; import {Landmarks} from 'react-native-vision-camera-face-detector'; import {Svg, Circle} from 'react-native-svg';

const DrawLandmarks = ({landmarks}) => { const { LEFT_CHEEK, LEFT_EAR, LEFT_EYE, MOUTH_BOTTOM, MOUTH_LEFT, MOUTH_RIGHT, NOSE_BASE, RIGHT_CHEEK, RIGHT_EAR, RIGHT_EYE, } = landmarks;

return (

{Object.values(landmarks).map((point, index) => ( ))}

); };

export default DrawLandmarks; Additional Information: Any information about the rotation, scaling issues, or other iPad-specific behavior would be helpful.

Image (1)

viktoria-budennaya commented 1 month ago

@luicfrr any updates on this one? Also experienced it

I've also noticed that frame.isMirrored on ios returns true for front camera and false for android. Passing isMirrored={false} to the camera on ios face recognition completely so no face is recognised

Could be connected?

luicfrr commented 1 month ago

Currently I'm really busy with other projects so I couldn't check this out. I know there are some "problems" with vision-camera frame orientation and mirroring that I haven't managed to fix yet in my tests.