uniocr 📸
universal ocr engine for rust that works everywhere. supports native ocr on macos, windows, tesseract, and cloud providers.
need a feature like NodeJS, HTTP example, etc.? open an issue or PR.
features 🚀
- native ocr
- macos: native vision kit api
- windows: windows ocr engine
- tesseract integration
- full support for tesseract with custom models
- fast initialization and caching
- cloud providers
- custom ocr provider
- unified api
- single interface for all providers
- easy provider switching
- batch processing support
- performance focused
- async/await support
- parallel processing
- memory efficient
- unsafe code memory leaks battle tested
quickstart 🏃
[]
= { = "https://github.com/mediar-ai/uniocr.git" }
use ;
use Result;
async
providers 🔌
// use native macos vision
let engine = new?;
// use windows ocr
let engine = new?;
// use tesseract
let engine = new?;
// use google cloud vision
// let engine = OcrEngine::new(OcrProvider::GoogleCloud {
// credentials: ...,
// })?;
advanced usage 🛠️
use ;
// configure ocr options
let options = default
.languages
.confidence_threshold
.timeout;
let engine = new?
.with_options;
// batch processing
let images = vec!;
let results = engine.recognize_batch.await?;
installation requirements 🔧
- macos: no additional setup (vision kit included)
- windows: windows 10+ with ocr capabilities
- tesseract:
tesseract-ocr
installed:# macos # ubuntu # windows
performance 📊
benchmark results on m4 macbook pro max (images/second):
provider | speed | accuracy |
---|---|---|
macos vision | 3.2 | 90.0% |
windows ocr | 1.2 | 95.2% |
tesseract | tbd | tbd |
google cloud | tbd | tbd |
contributing 🤝
contributions welcome!
license 📜
this project is licensed under either of:
- apache license, version 2.0 (LICENSE-APACHE)
- mit license (LICENSE-MIT)
at your option.
acknowledgments 🙏
- apple vision team
- microsoft windows ocr team
- tesseract ocr project
- cloud provider teams
examples 📚
the repository includes several example programs demonstrating different use cases:
run examples
# basic example
# batch processing
# custom options
# platform specific
check the examples directory for more detailed examples including:
- batch processing multiple images
- configuring custom options
- using platform-specific providers
- handling multilingual text