首页 > 解决方案 > react-native-camera人脸检测

问题描述

使用react-native-camera尝试面部识别不起作用。

<RNCamera
faceDetectionMode={RNCamera.Constants.FaceDetection.Mode.fast}
onFacesDetected={(face)=>{
   console.log(face)
 }}
/>

我得到错误

TypeError: cannot read property fast of undefined" triggered by faceDetectionMode={RNCamera.Constants.FaceDetection.Mode.fast}

当我打印出来

console.log('RNCAMERA',RNCamera.Constants)

{"AutoFocus": {"off": 0, "on": 2},.....,  "FaceDetection": {}, .....}

人脸检测为空。

我正在使用 react-native-camera@3.42.2

我也按照这些步骤让它工作。目前只测试ios。

pod 'react-native-camera', path: '../node_modules/react-native- camera', subspecs: ['FaceDetectorMLKit']

cd ios && pod install && cd ..

我在 pod install 上遇到的错误是

Unable to find a specification for `MLImage (= 1.0.0-beta1)` depended upon by `MLKitVision`

这是一个错误吗?

标签: react-nativeface-detectionreact-native-camera

解决方案


推荐阅读