react-native-vision-camera-text-recognition
A plugin to Scanning Text,Translate using ML Kit Text Recognition and ML Kit Translation. With High Performance and many features.
🚨 Required Modules
react-native-vision-camera = 4.3.2
react-native-worklets-core = 1.3.3
💻 Installation
npm install react-native-vision-camera-text-recognition
yarn add react-native-vision-camera-text-recognition
👷Features
Easy To Use.
Works Just Writing few lines of Code.
Works With React Native Vision Camera.
Works for Both Cameras.
Works Fast.
Works With Android 🤖 and IOS.📱
Writen With Kotlin and Swift.
Can translate text. 🌍
💡 Usage
📚 For Recognize Text
import React, { useState } from 'react'
import { useCameraDevice } from 'react-native-vision-camera'
import { Camera } from 'react-native-vision-camera-text-recognition';
function App (){
const [data,setData] = useState(null)
const device = useCameraDevice('back');
console.log(data)
return(
<>
{!!device && (
<Camera
style={StyleSheet.absoluteFill}
device={device}
isActive
options={{
language: 'latin'
}}
mode={'recognize'}
callback={(d) => setData(d)}
/>
)}
</>
)
}
export default App;
🌍 For Translate Text
import React, { useState } from 'react'
import { useCameraDevice } from 'react-native-vision-camera'
import { Camera } from 'react-native-vision-camera-text-recognition';
function App (){
const [data,setData] = useState(null)
const device = useCameraDevice('back');
console.log(data)
return(
<>
{!!device && (
<Camera
style={StyleSheet.absoluteFill}
device={device}
isActive
options={{
from: 'en',
to: 'de'
}}
mode={'translate'}
callback={(d) => setData(d)}
/>
)}
</>
)
}
export default App;
Also You Can Use Like This
import React from 'react';
import { StyleSheet } from "react-native";
import {
Camera,
useCameraDevice,
useFrameProcessor,
} from "react-native-vision-camera";
import { useTextRecognition } from "react-native-vision-camera-text-recognition";
function App() {
const device = useCameraDevice('back');
const options = { language : 'latin' }
const {scanText} = useTextRecognition(options)
const frameProcessor = useFrameProcessor((frame) => {
'worklet'
const data = scanText(frame)
console.log(data, 'data')
}, [])
return (
<>
{!!device && (
<Camera
style={StyleSheet.absoluteFill}
device={device}
isActive
mode={'recognize'}
frameProcessor={frameProcessor}
/>
)}
</>
);
}
export default App;
⚙️ Options
Name | Type | Values | Default |
---|
language | string | latin, chinese, devanagari, japanese, korean | latin |
mode | string | recognize, translate | recognize |
from,to | string | See Below | en,de |
You can also remove unnecessary translation model
import { RemoveLanguageModel } from "react-native-vision-camera-text-recognition";
const bool = await RemoveLanguageModel("en")
Afrikaans: 🇿🇦, 🇨🇫 <---> code : "af"
Albanian: 🇦🇱 <---> code : "sq"
Arabic: 🇦🇪, 🇸🇦 <---> code : "ar"
Belarusian: 🇧🇾 <---> code : "be"
Bulgarian: 🇧🇬 <---> code : "bn"
Bengali: 🇧🇩 <---> code : "bg"
Catalan: 🏴 <---> code : "ca"
Czech: 🇨🇿 <---> code : "cs"
Welsh: 🏴 <---> code : "cy"
Danish: 🇩🇰 <---> code : "da"
German: 🇩🇪 <---> code : "de"
Greek: 🇬🇷 <---> code : "el"
English: 🇬🇧, 🇺🇸 <---> code : "en"
Esperanto: 🌍 <---> code : "eo"
Spanish: 🇪🇸 <---> code : "es"
Estonian: 🇪🇪 <---> code : "et"
Persian: 🇮🇷 <---> code : "fa"
Finnish: 🇫🇮 <---> code : "fi"
French: 🇫🇷 <---> code : "fr"
Irish: 🇮🇪 <---> code : "ga"
Galician: 🏴 <---> code : "gl"
Gujarati: 🏴 <---> code : "gu"
Hebrew: 🇮🇱 <---> code : "he"
Hindi: 🇮🇳 <---> code : "hi"
Croatian: 🇭🇷 <---> code : "hr"
Haitian: 🇭🇹 <---> code : "ht"
Hungarian: 🇭🇺 <---> code : "hu"
Indonesian: 🇮🇩 <---> code : "id"
Icelandic: 🇮🇸 <---> code : "is"
Italian: 🇮🇹 <---> code : "it"
Japanese: 🇯🇵 <---> code : "ja"
Georgian: 🇬🇪 <---> code : "ka"
Kannada: 🇨🇦 <---> code : "kn"
Korean: 🇰🇷, 🇰🇵 <---> code : "ko"
Lithuanian: 🇱🇹 <---> code : "lt"
Latvian: 🇱🇻 <---> code : "lv"
Macedonian: 🇲🇰 <---> code : "mk"
Marathi: 🇮🇳 <---> code : "mr"
Malay: 🇲🇾 <---> code : "ms"
Maltese: 🇲🇹 <---> code : "mt"
Dutch: 🇳🇱 <---> code : "nl"
Norwegian: 🇳🇴 <---> code : "no"
Polish: 🇵🇱 <---> code : "pl"
Portuguese: 🇵🇹 <---> code : "pt"
Romanian: 🇷🇴 <---> code : "ro"
Russian: 🇷🇺 <---> code : "ru"
Slovak: 🇸🇰 <---> code : "sk"
Slovenian: 🇸🇮 <---> code : "sl"
Swedish: 🇸🇪 <---> code : "sv"
Swahili: 🇰🇪 <---> code : "sw"
Tamil: 🇱🇰 <---> code : "ta"
Telugu: 🇮🇳 <---> code : "te"
Thai: 🇹🇭 <---> code : "th"
Tagalog: 🇵🇭 <---> code : "tl"
Turkish: 🇹🇷 <---> code : "tr"
Ukrainian: 🇺🇦 <---> code : "uk"
Urdu: 🇵🇰 <---> code : "ur"
Vietnamese: 🇻🇳 <---> code : "vi"
Chinese: 🇨🇳 <---> code : "zh"