使用 react-native-firebase 的设备文本检测要求计费

On device text detection with react-native-firebase asks for billing

我正在使用 react-native-firebase-mlkit 视觉来处理从相机拍摄的图像(使用 react-native-camera)。文本检测需要计费,但 firebase 文档说设备检测是免费的。 这是我正在使用的片段

  processImage = async () => {
    const {photoUri} = this.state;
    console.log('processing Image...');
    vision()
      .cloudTextRecognizerProcessImage(photoUri)
      .then(processed => {
        console.log('processImage response', processed);
      })
      .catch(error => {
        console.log('process error', error);
      });
  };

这是错误

如何使用 react-native-firebase-mlkit 视觉激活设备检测?

好的,我明白了。 对于 on device detection with react-native-firebase-mlkit vision 你必须使用 textRecognizerProcessImage() 函数而不是 cloudTextRecognizerProcessImage()

  processImage = async () => {
    const {photoUri} = this.state;
    console.log('processing Image...');
    vision()
      .textRecognizerProcessImage(photoUri)
      .then(processed => {
        console.log('processImage response', processed);
      })
      .catch(error => {
        console.log('process error', error);
      });
  };