In Operation
When ocrs runs for the first time, it automatically downloads the required models and stores in them in ~/.cache/ocrs.
We can perform OCR on an image simply with a command such as:
$ ocrs filename
As we didn’t include the -o
option, the program defaults to stdout. The table below summarizes the options available:
Options | |
---|---|
--detect-model | Use a custom text detection model |
-j, --json | Output text and structure in JSON format |
-o, --output | Output file path (defaults to stdout) |
-p, --png | Output annotated copy of input image in PNG format |
--rec-model | Use a custom text recognition model |
--beam | Use beam search for decoding |
--debug | Enable debug output |
--version | Display version information |
Here’s another example command with an image that has been annotated to show the location of detected words and lines.
$ ocrs textbook.jpg --png -o ocrs-annotated.png
Original Image | Annotated image with detected words and lines.
Summary
Given that Linux doesn’t have many high quality open source OCR engines, ocrs is a worthwhile project.
ocrs is in an early stage of development but already produces fast, and good quality output. It uses machine learning extensively in the pipeline which helps it produce good results on a wide range of images.
The software is trained on open and liberally licensed datasets.
ocrs can provide character-level bounding boxes, but only after doing text recognition. The initial text detection phase produces only word-level bounding boxes, but the text recognition phase produces character-level bounding boxes as a side-effect of recognizing the text.
There’s currently no support for models that can recognise non-Latin text, but this functionality is planned.
Website: github.com/robertknight/ocrs
Support:
Developer: Ocrs project contributors
License: MIT License or Apache License 2.0
ocrs is written in Rust. Learn Rust with our recommended free books and free tutorials
For other useful open source apps that use machine learning/deep learning, we’ve compiled this roundup.
Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary