[英]React native camera detecting face
Does anyone know how to enable the React-native-camera face detection feature?有谁知道如何启用 React-native-camera 人脸检测功能?
I've followed the guide on https://github.com/react-native-community/react-native-camera such as importing and changing the line on package.json but still don't see anything happening to my camera when it is in front of a face我遵循了https://github.com/react-native-community/react-native-camera上的指南,例如导入和更改 package.json 上的行,但仍然没有看到我的相机发生任何事情在一张脸面前
react-native-camera doesn't do anything on its own to let you know that the face detection is working. react-native-camera 本身不会做任何事情来让您知道面部检测正在工作。 It is up to you to do something with the data it provides.
您可以对它提供的数据做些什么。
This code snippet would show some text when a face is detected, for example:当检测到人脸时,此代码段将显示一些文本,例如:
constructor(props) {
super(props);
this.state = { isFaceDetected: false };
}
handleFaceDetected = faceArray => {
this.setState(state => { ...state, isFaceDetected: true });
};
// ...
<RNCamera
faceDetectionMode={RNCamera.Constants.FaceDetection.Mode.fast}
onFacesDetected={this.handleFaceDetected}
/>
{this.state.isFaceDetected && (<Text>I saw a face</Text>)}
See the react-native-camera face-detection documentation for more details.有关更多详细信息,请参阅react-native-camera 人脸检测文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.