Package Exports
- @lunarhue/camera-text-recognition-native
- @lunarhue/camera-text-recognition-native/lib/commonjs/index.js
- @lunarhue/camera-text-recognition-native/lib/module/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lunarhue/camera-text-recognition-native) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.5.1
react-native-worklets-core = 1.3.3
Installation
npm install @lunarhue/camera-text-recognition-native
yarn add @lunarhue/camera-text-recognition-nativeFeatures
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 Recognize Text From Photo. đ¸
Can translate text. đđĄ Usage
đ For Live Recognition Text
import React, { useState } from 'react'
import { useCameraDevice } from 'react-native-vision-camera'
import { Camera } from '@lunarhue/camera-text-recognition-native';
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 '@lunarhue/camera-text-recognition-native';
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 "@lunarhue/camera-text-recognition-native";
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 |
Recognize By Photo đ¸
import { PhotoRecognizer } from "@lunarhue/camera-text-recognition-native";
const result = await PhotoRecognizer({
uri:assets.uri,
orientation: "portrait"
})
console.log(result);
đ¨ Orientation available only for iOS, recommendation give it when you are using Camera.
| Name | Type | Values | Required | Default | Platform |
|---|---|---|---|---|---|
| uri | string | yes | android, iOS | ||
| orientation | string | portrait, portraitUpsideDown, landscapeLeft, landscapeRight | no | portrait | iOS |
You can also remove unnecessary translation model
import { RemoveLanguageModel } from "@lunarhue/camera-text-recognition-native";
const bool = await RemoveLanguageModel("en")Supported Languages.
<h3>Afrikaans: đżđŚ, đ¨đŤ <---> code : "af"</h3>
<h3>Albanian: đŚđą <---> code : "sq"</h3>
<h3>Arabic: đŚđŞ, đ¸đŚ <---> code : "ar"</h3>
<h3>Belarusian: đ§đž <---> code : "be"</h3>
<h3>Bulgarian: đ§đŹ <---> code : "bn"</h3>
<h3>Bengali: đ§đŠ <---> code : "bg"</h3>
<h3>Catalan: đ´ <---> code : "ca"</h3>
<h3>Czech: đ¨đż <---> code : "cs"</h3>
<h3>Welsh: đ´ó §ó ˘ó ˇó Źó łó ż <---> code : "cy"</h3>
<h3>Danish: đŠđ° <---> code : "da"</h3>
<h3>German: đŠđŞ <---> code : "de"</h3>
<h3>Greek: đŹđˇ <---> code : "el"</h3>
<h3>English: đŹđ§, đşđ¸ <---> code : "en"</h3>
<h3>Esperanto: đ <---> code : "eo"</h3>
<h3>Spanish: đŞđ¸ <---> code : "es"</h3>
<h3>Estonian: đŞđŞ <---> code : "et"</h3>
<h3>Persian: đŽđˇ <---> code : "fa"</h3>
<h3>Finnish: đŤđŽ <---> code : "fi"</h3>
<h3>French: đŤđˇ <---> code : "fr"</h3>
<h3>Irish: đŽđŞ <---> code : "ga"</h3>
<h3>Galician: đ´ <---> code : "gl"</h3>
<h3>Gujarati: đ´ <---> code : "gu"</h3>
<h3>Hebrew: đŽđą <---> code : "he"</h3>
<h3>Hindi: đŽđł <---> code : "hi"</h3>
<h3>Croatian: đđˇ <---> code : "hr"</h3>
<h3>Haitian: đđš <---> code : "ht"</h3>
<h3>Hungarian: đđş <---> code : "hu"</h3>
<h3>Indonesian: đŽđŠ <---> code : "id"</h3>
<h3>Icelandic: đŽđ¸ <---> code : "is"</h3>
<h3>Italian: đŽđš <---> code : "it"</h3>
<h3>Japanese: đŻđľ <---> code : "ja"</h3>
<h3>Georgian: đŹđŞ <---> code : "ka"</h3>
<h3>Kannada: đ¨đŚ <---> code : "kn"</h3>
<h3>Korean: đ°đˇ, đ°đľ <---> code : "ko"</h3>
<h3>Lithuanian: đąđš <---> code : "lt"</h3>
<h3>Latvian: đąđť <---> code : "lv"</h3>
<h3>Macedonian: đ˛đ° <---> code : "mk"</h3>
<h3>Marathi: đŽđł <---> code : "mr"</h3>
<h3>Malay: đ˛đž <---> code : "ms"</h3>
<h3>Maltese: đ˛đš <---> code : "mt"</h3>
<h3>Dutch: đłđą <---> code : "nl"</h3>
<h3>Norwegian: đłđ´ <---> code : "no"</h3>
<h3>Polish: đľđą <---> code : "pl"</h3>
<h3>Portuguese: đľđš <---> code : "pt"</h3>
<h3>Romanian: đˇđ´ <---> code : "ro"</h3>
<h3>Russian: đˇđş <---> code : "ru"</h3>
<h3>Slovak: đ¸đ° <---> code : "sk"</h3>
<h3>Slovenian: đ¸đŽ <---> code : "sl"</h3>
<h3>Swedish: đ¸đŞ <---> code : "sv"</h3>
<h3>Swahili: đ°đŞ <---> code : "sw"</h3>
<h3>Tamil: đąđ° <---> code : "ta"</h3>
<h3>Telugu: đŽđł <---> code : "te"</h3>
<h3>Thai: đšđ <---> code : "th"</h3>
<h3>Tagalog: đľđ <---> code : "tl"</h3>
<h3>Turkish: đšđˇ <---> code : "tr"</h3>
<h3>Ukrainian: đşđŚ <---> code : "uk"</h3>
<h3>Urdu: đľđ° <---> code : "ur"</h3>
<h3>Vietnamese: đťđł <---> code : "vi"</h3>
<h3>Chinese: đ¨đł <---> code : "zh"</h3>