Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jonathanpalma/react-native-tesseract-ocr
Tesseract OCR wrapper for React Native
https://github.com/jonathanpalma/react-native-tesseract-ocr
android ocr optical-character-recognition react-native tesseract tesseract-ocr text-detection text-detector text-recognition
Last synced: 2 days ago
JSON representation
Tesseract OCR wrapper for React Native
- Host: GitHub
- URL: https://github.com/jonathanpalma/react-native-tesseract-ocr
- Owner: jonathanpalma
- License: mit
- Created: 2016-09-04T19:53:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-10-21T03:19:59.000Z (over 1 year ago)
- Last Synced: 2024-05-01T20:36:59.934Z (9 months ago)
- Topics: android, ocr, optical-character-recognition, react-native, tesseract, tesseract-ocr, text-detection, text-detector, text-recognition
- Language: Java
- Homepage:
- Size: 6.18 MB
- Stars: 547
- Watchers: 20
- Forks: 171
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[![Version][version-badge]][package]
[![Install Size][size-badge]][package-size]
[![Downloads][downloads-badge]][npmcharts]
[![PRs Welcome][prs-badge]][prs]
[![Commitizen friendly][cz-badge]][cz]
[![MIT License][license-badge]][license][![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
[![Watch on GitHub][github-watch-badge]][github-watch]
[![Star on GitHub][github-star-badge]][github-star]
[![Tweet][twitter-badge]][twitter]This project uses:
- [tess-two][url-tess-and] for Android
- [Tesseract-OCR-iOS][url-tess-ios] for iOS ⚠️ (This has NOT been implemented yet) ⚠️NOTE: It is recommended to use react-native >= 0.60.0
## Getting started
`$ npm i react-native-tesseract-ocr --save`
### Mostly automatic installation
`$ react-native link react-native-tesseract-ocr`
## Example
Check the example by yourself [here][url-example]
## Usage
### tessOptions
| Property | Type | Description |
| --------- | -------- | -------------------------------------------------------------------------- |
| allowlist | `string` | List of characters you want to recognize |
| denylist | `string` | List of characters you DON'T want to recognize |
| level | `Level` | Level of the tokens of the page hierarchy (only used in `recognizeTokens`) |_`Level` can be one of the following values 'symbol' | 'block' | 'line' | 'paragraph' | 'word'_
### recognize
```typescript
import TesseractOcr, { LANG_ENGLISH } from 'react-native-tesseract-ocr';const tessOptions = {};
TesseractOcr.recognize(imageSource, LANG_ENGLISH, tessOptions);
```### recognizeTokens
```typescript
import TesseractOcr, { LANG_ENGLISH, LEVEL_WORD } from 'react-native-tesseract-ocr';const tessOptions = { level: LEVEL_WORD };
TesseractOcr.recognizeTokens(imageSource, LANG_ENGLISH, tessOptions);
```### useEventListener
```typescript
import React, { useState } from 'react';
import { useEventListener } from 'react-native-tesseract-ocr';function App() {
const [progress, setProgress] = useState(0);
useEventListener('onProgressChange', (p) => {
setProgress(p.percent / 100);
});// return ...
}
```## Contributing
### How to contribute?
This is a `commitizen friendly` repository, so instead of creating commits using `git commit`, please use our custom CLI by running:
`$ npm run cz`
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Jonathan Palma
💻 📖 💡
Johan Runsten
💻
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
## License
MIT © [jonathanpalma](https://github.com/jonathanpalma)
This library wouldn't be possible without these amazing projects:
- [Tesseract OCR][url-tesseract] - [Apache 2.0 license][url-tesseract-lsc]
- [tess-two][url-tess-and] - [Apache 2.0 license][url-tess-and-lsc][downloads-badge]: https://img.shields.io/npm/dm/react-native-tesseract-ocr.svg?style=flat-square
[license-badge]: https://img.shields.io/npm/l/react-native-tesseract-ocr.svg?style=flat-square
[license]: https://github.com/jonathanpalma/react-native-tesseract-ocr/blob/master/LICENSE
[npmcharts]: http://npmcharts.com/compare/react-native-tesseract-ocr
[package-size]: https://packagephobia.now.sh/result?p=react-native-tesseract-ocr
[package]: https://www.npmjs.com/package/react-native-tesseract-ocr
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
[cz-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square
[cz]: http://commitizen.github.io/cz-cli/
[size-badge]: https://flat.badgen.net/packagephobia/install/react-native-tesseract-ocr
[version-badge]: https://img.shields.io/npm/v/react-native-tesseract-ocr.svg?style=flat-square
[github-watch-badge]: https://img.shields.io/github/watchers/jonathanpalma/react-native-tesseract-ocr.svg?style=social
[github-watch]: https://github.com/jonathanpalma/react-native-tesseract-ocr/watchers
[github-star-badge]: https://img.shields.io/github/stars/jonathanpalma/react-native-tesseract-ocr.svg?style=social
[github-star]: https://github.com/jonathanpalma/react-native-tesseract-ocr/stargazers
[url-example]: https://github.com/jonathanpalma/react-native-tesseract-ocr/tree/master/example
[url-eslint]: https://eslint.org/
[url-prettier]: https://prettier.io/
[url-tesseract]: https://github.com/tesseract-ocr/tesseract
[url-tesseract-lsc]: https://github.com/tesseract-ocr/tesseract/blob/master/LICENSE
[url-tess-and]: https://github.com/rmtheis/tess-two
[url-tess-and-lsc]: https://github.com/rmtheis/tess-two/blob/master/COPYING
[url-tess-ios]: https://github.com/gali8/Tesseract-OCR-iOS
[url-tess-ios-lsc]: https://github.com/gali8/Tesseract-OCR-iOS/blob/master/LICENSE.md
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20react-native-tesseract-ocr!%20https://github.com/jonathanpalma/react-native-tesseract-ocr
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/jonathanpalma/react-native-tesseract-ocr.svg?style=social