Skip to content

Latest commit

 

History

History
167 lines (151 loc) · 4.34 KB

File metadata and controls

167 lines (151 loc) · 4.34 KB

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.0.5
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

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: 'translate',
            from: 'english',
            to: 'german'
          }}
          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', mode: 'recognize' }
  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
          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 english,german

Afrikaans: 🇿🇦, 🇨🇫

Albanian: 🇦🇱

Arabic: 🇦🇪, 🇸🇦

Belarusian: 🇧🇾

Bulgarian: 🇧🇬

Bengali: 🇧🇩, 🇮🇳

Catalan: 🇪🇸, 🇦🇩

Czech: 🇨🇿

Welsh: 🏴

Danish: 🇩🇰

German: 🇩🇪

Greek: 🇬🇷

English: 🇬🇧, 🇺🇸

Esperanto: 🌍

Spanish: 🇪🇸

Estonian: 🇪🇪

Persian: 🇮🇷, 🇦🇫

Finnish: 🇫🇮

French: 🇫🇷

Irish: 🇮🇪

Galician: 🇪🇸

Gujarati: 🇮🇳

Hebrew: 🇮🇱

Hindi: 🇮🇳

Croatian: 🇭🇷

Haitian: 🇭🇹

Hungarian: 🇭🇺

Indonesian: 🇮🇩

Icelandic: 🇮🇸

Italian: 🇮🇹

Japanese: 🇯🇵

Georgian: 🇬🇪

Canada: 🇨🇦

Korean: 🇰🇷, 🇰🇵

Lithuanian: 🇱🇹

Latvian: 🇱🇻

Macedonian: 🇲🇰

Marathi: 🇮🇳

Malay: 🇲🇾, 🇸🇬

Maltese: 🇲🇹

Dutch: 🇳🇱, 🇧🇪

Norwegian: 🇳🇴

Polish: 🇵🇱

Portuguese: 🇵🇹

Romanian: 🇷🇴

Russian: 🇷🇺

Slovak: 🇸🇰

Slovenian: 🇸🇮

Swedish: 🇸🇪, 🇫🇮

Swahili: 🇰🇪, 🇹🇿

Tamil: 🇮🇳, 🇱🇰

Telugu: 🇮🇳

Thai: 🇹🇭

Tagalog: 🇵🇭

Turkish: 🇹🇷

Ukrainian: 🇺🇦

Urdu: 🇵🇰, 🇮🇳

Vietnamese: 🇻🇳

Chinese: 🇨🇳