Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
react-native-face-detection-tc
Advanced tools
react-native face detection using Google ML Kit.
Some part of the code is from react-native-firebase ml-vision package (version 6.4.0) but due to Google separate Firebase ML Kit into Google ML Kit and Firebase Machine Learning then the ml-vision will no longer available on react-native-firebase.
This package bring back face detection feature from ml-vision package.
You can use npm or yarn to install the latest version:
npm
npm install --save react-native-face-detection
yarn
yarn add react-native-face-detection
Run npx pod-install
after installing the package
import FaceDetection, { FaceDetectorContourMode, FaceDetectorLandmarkMode, FaceContourType } from "react-native-face-detection";
async function processFaces(imagePath) {
const options = {
landmarkMode: FaceDetectorLandmarkMode.ALL,
contourMode: FaceDetectorContourMode.ALL
};
const faces = await FaceDetection.processImage(imagePath, options);
faces.forEach(face => {
console.log('Head rotation on X axis: ', face.headEulerAngleX);
console.log('Head rotation on Y axis: ', face.headEulerAngleY);
console.log('Head rotation on Z axis: ', face.headEulerAngleZ);
console.log('Left eye open probability: ', face.leftEyeOpenProbability);
console.log('Right eye open probability: ', face.rightEyeOpenProbability);
console.log('Smiling probability: ', face.smilingProbability);
face.faceContours.forEach(contour => {
if (contour.type === FaceContourType.FACE) {
console.log('Face outline points: ', contour.points);
}
});
face.landmarks.forEach(landmark => {
if (landmark.type === FaceLandmarkType.LEFT_EYE) {
console.log('Left eye outline points: ', landmark.points);
} else if (landmark.type === FaceLandmarkType.RIGHT_EYE) {
console.log('Right eye outline points: ', landmark.points);
}
});
});
}
// Local path to file on the device
const imagePath = '/path/to/face-image.png';
processFaces(imagePath).then(() => console.log('Finished processing file.'));
Check example
foler.
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
FAQs
react-native face detection using Google MLKit
The npm package react-native-face-detection-tc receives a total of 0 weekly downloads. As such, react-native-face-detection-tc popularity was classified as not popular.
We found that react-native-face-detection-tc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.