我尝试使用各种库(例如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)