the FaceDetector from ‘expo-face-detector’ has been marked as ‘deprecated’ in sdk 51 and the official expo documentation recommends to use ‘react-native-vision-camera’. Below is my old function
<code>import * as FaceDetector from 'expo-face-detector';
const detectFaces = useCallback(async (imageUri: string) => {
try {
const options = {
mode: FaceDetector.FaceDetectorMode.fast,
detectLandmarks: FaceDetector.FaceDetectorLandmarks.none,
runClassifications: FaceDetector.FaceDetectorClassifications.none,
};
return await FaceDetector.detectFacesAsync(imageUri, options);
} catch (error) {
console.log("🚀 ~ file: SeancePhoto.tsx ~ line 54 ~ detectFaces ~ error", error)
}
}, [],)
</code>
<code>import * as FaceDetector from 'expo-face-detector';
const detectFaces = useCallback(async (imageUri: string) => {
try {
const options = {
mode: FaceDetector.FaceDetectorMode.fast,
detectLandmarks: FaceDetector.FaceDetectorLandmarks.none,
runClassifications: FaceDetector.FaceDetectorClassifications.none,
};
return await FaceDetector.detectFacesAsync(imageUri, options);
} catch (error) {
console.log("🚀 ~ file: SeancePhoto.tsx ~ line 54 ~ detectFaces ~ error", error)
}
}, [],)
</code>
import * as FaceDetector from 'expo-face-detector';
const detectFaces = useCallback(async (imageUri: string) => {
try {
const options = {
mode: FaceDetector.FaceDetectorMode.fast,
detectLandmarks: FaceDetector.FaceDetectorLandmarks.none,
runClassifications: FaceDetector.FaceDetectorClassifications.none,
};
return await FaceDetector.detectFacesAsync(imageUri, options);
} catch (error) {
console.log("🚀 ~ file: SeancePhoto.tsx ~ line 54 ~ detectFaces ~ error", error)
}
}, [],)
I saw how we can detect faces on frames using ‘react-native-vision-camera’ but not on images whose uri we could provide.