I tried using various libraries such as react-native-tesseract
react-native-text-detector
in Expo in order to integrate OCR but they did not work. This is my code and I am wondering how to integrate OCR within it. Thank you in advance for solutions!
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: "flex",
alignItems: "center",
justifyContent: "space-between",
width: "100%",
flexDirection: "row",
}}
>
<TouchableOpacity onPress={this.takePicture}>
<Image
style={{ width: 90, height: 90 }}
source={require("./assets/rec.png")}
/>
</TouchableOpacity>
</View>
</>
);
runOcr is the function where OCR happens however I removed the OCR code.