1

Hi I'm very new to react native, i have to develop an app like whenever camera detects the face, automatically we need to display the person age and gender without any button click event.

I'm using Kairos API to display the age and gender but i need to call the API whenever camera or webcam detects the face using react native?

Anyone have any idea on this? Please suggest me.

user3668438
  • 165
  • 5
  • 18

1 Answers1

0

You can use react-native-camera to detect faces - and take action when a face is detected.

The code might look roughly like:

capturePhoto = async (faceArray) => {
    const options = { quality: 0.5, base64: true };
    const data = await this.camera.takePictureAsync(options);
    const result = sendToKairos(data);
};

// ...

<RNCamera
    ref={ref => (this.camera = ref)}
    faceDetectionMode={RNCamera.Constants.FaceDetection.Mode.fast}
    onFacesDetected={this.capturePhoto}
/>

See the react-native-camera face-detection documentation for more details.

davidpricedev
  • 2,107
  • 2
  • 20
  • 34