Skip to content

thoaintbap/react-native-text-recognition

 
 

Repository files navigation

React-Native-Text-Recognition

Very basic text recognition utilizing the Vision framework on iOS and Firebase ML on Android

I also have a version that utilizes Firebase ML on both iOS and Android. You can check that out or install it on the ml-only branch!

Installation

yarn add react-native-text-recognition

or with NPM:

npm install react-native-text-recognition

iOS:

Make sure that your Podfile's minimum deployment target is 13.0 or greater!!

If you get an error about "Could not find or use auto-linked library 'xxxxx'" then add the following to your project's Build Settings under LIBRARY_SEARCH_PATHS:

"$(SDKROOT)/usr/lib/swift"

This error is most common on XCode 12+


Usage

import TextRecognition from 'react-native-text-recognition';

// pass the image's path to recognize

const result = await TextRecognition.recognize('/var/mobile/...');

Configuration and Options

There is an optional configuration object affecting iOS vision only. It includes one key, visionIgnoreThreshold which is a number (<= 1).

type TextRecognitionOptions = {
  visionIgnoreThreshold?: number;
};

It is used at the end of the recognize function:

const result = await TextRecognition.recognize('/var/mobile/...', {
  visionIgnoreThreshold: 0.5,
});

The only thing that this changes is whether or not to return a recognized string based on the Vision Framework's "confidence." You can read more at https://developer.apple.com/documentation/vision/vnobservation/2867220-confidence/

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 53.0%
  • Swift 27.4%
  • Ruby 7.2%
  • TypeScript 6.4%
  • Objective-C 5.1%
  • JavaScript 0.9%