Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
react-native-facerecognition
Advanced tools
Detect and Recognize faces as fast as possible in react native!
💥 New version with new features @3.0.0!
x86 CPU
Download this package Click herex86_64 CPU
Download this package Click herearm64-v8a CPU
Download this package Click hereAfter downloading you need to put that package into this location react-native-facerecognition/android/app/src/main/jniLibs
and that's all!
⚠️ Since we're focusing our efforts on next updates, we are really welcome for any issues/pulls to improve the way we go.
import Camera from 'react-native-facerecognition';
...
<Camera
ref={(cam) => {
this.camera = cam;
}}
style={styles.preview}
aspect={Camera.constants.Aspect.fill}
captureQuality={Camera.constants.CaptureQuality.high}
touchToFocus
torchMode={Camera.constants.TorchMode.on}
rotateMode={Camera.constants.RotateMode.on}
cameraType={Camera.constants.CameraType.front}
model = {Camera.constants.Model.lbp}
dataset
distance = {200}
onTrained = {this.onTrained}
onRecognized = {this.onRecognized}
onUntrained = {this.onUntrained}
onUnrecognized = {this.onUnrecognized}
/>
🔥 Checkout our main example to get the right way to start.
npm install react-native-facerecognition --save
or
yarn add react-native-facerecognition
⚠️ We are highly recommend you to use Deamon gradle for building faster and ignore any error may happen.
build.gradle
put this line in projectName/android/build.gradle
.repositories {
...
google()
}
...
classpath 'com.android.tools.build:gradle:3.0.1'
...
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
...
}
}
projectName/android/gradle/wrapper/gradle-wrapper.properties
and change this.distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
react-native link react-native-facerecognition
build.gradle
and the path projectName/android/app/build.gradle
.compileSdkVersion 26
buildToolsVersion "26.0.2"
....
....
settings.gradle
and the path projectName/android/settings.gradle
.include ':openCV'
project(':openCV').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-facerecognition/android/openCV')
AndroidManifest.xml
and remove the line below.<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="true"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
...
<activity
android:windowSoftInputMode="adjustResize" // remove this in order to make UI works well
MainApplication.java
and its path projectName/android/app/src/main/java/com/projectName/MainApplication.java
.import opencv.android.FaceModulePackage;
...
return Arrays.<ReactPackage>asList(
new FaceModulePackage()
);
build.gradle
and the path projectName/android/app/build.gradle
.compileSdkVersion 26
buildToolsVersion "26.0.2"
....
....
....
dependencies {
compile project(':react-native-facerecognition')
}
settings.gradle
put these lines you can find the path at projectName/android/settings.gradle
include ':react-native-facerecognition'
project(':react-native-facerecognition').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-facerecognition/android/app')
include ':openCV'
project(':openCV').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-facerecognition/android/openCV')
AndroidManifest.xml
and remove the line below.<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="true"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
...
<activity
android:windowSoftInputMode="adjustResize" // remove this in order to make UI works well
🔥 You're ready to go!
How it works:
There's three main process you have to follow the first one is to detect the face first on the image, Then you do some training on every face (Person1 & Person2 & Person3) you will need to recognize later which is the second process. Then, you can now after training, Recognize all these faces by their names.
model
cameraType
captureQuality
aspect
dataset
(default: false)
android/app/src/main/assets/dataset
inside that folder.if you will use this, you need to use lbp model only in order to make it work. Please see the test photo there to know how to rename your photos according to that test photo every photo should be named like that name_number.jpg/png.
distance
<Camera distance = {200} />
rotateMode
- (Landscape/Portrait)
Take a picture then process it to detect face inside
Train the algorithm with a new detected face
Take a picture then predict whom face belongs to
Clear all previous trained faces
onTrained
onUntrained
onRecognized
You get details about recognized face:
name
The face nameconfidence
This number indicates how much the result is true. Usually low number < 100 means a good result depends on the distance you putonUnrecognized
If you're not familiar with OpenCV and face recognition you have to be in safe and use our default arguments as we care about all of the details for you. In case of using your own arguments please note that you may effect the accuracy depends on your settings.
🚀 Updates you can find all previous versions and updates up to date!
MIT
FAQs
Detect and Recognize faces as fast as possible in react native!
The npm package react-native-facerecognition receives a total of 4 weekly downloads. As such, react-native-facerecognition popularity was classified as not popular.
We found that react-native-facerecognition demonstrated a not healthy version release cadence and project activity because the last version was released 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.