小编Ben*_*sky的帖子

如何将 OCR 与 Expo 集成

我尝试使用各种库(例如react-native-tesseract react-native-text-detectorExpo 中的库)来集成 OCR,但它们不起作用。这是我的代码,我想知道如何在其中集成 OCR。预先感谢您的解决方案!

  takePicture = async () => {
    if (this.camera) {
      const options = { quality: 0.5, base64: true };
      const data = await this.camera.takePictureAsync(options);
      this.runOcr(data.uri);
    }
  };

  runOcr = async (imageUri) => {
    //code here
  };
    return (
      <>
        <Camera
          ref={(ref) => {
            this.camera = ref;
          }}
          style={{
            flex: 1,
            position: "absolute",
            width: "100%",
            height: "100%",
          }}
          type={Camera.Constants.Type.back}
          autoFocus={Camera.Constants.AutoFocus.on}
          flashMode={
            !this.state.isFlash
              ? Camera.Constants.FlashMode.off
              : Camera.Constants.FlashMode.on
          }
        />
        <View
          style={{
            position: "absolute",
            bottom: "5%",
            display: …
Run Code Online (Sandbox Code Playgroud)

ocr scanning react-native expo

6
推荐指数
0
解决办法
344
查看次数

标签 统计

expo ×1

ocr ×1

react-native ×1

scanning ×1