robertknight / ocrs

Rust library and CLI tool for OCR (extracting text from images)
Apache License 2.0
1.09k stars 44 forks source link

Add `--text-mask` flag to CLI tool #38

Closed robertknight closed 5 months ago

robertknight commented 5 months ago

This saves the binarized version of the text probability map as a PNG file. This is useful to see where detections were above/below the current confidence threshold.

Input image:

why-rust

Probability map (text-map.png, generated by --text-map):

Binary mask (text-mask.png, generated by --text-mask):

robertknight commented 5 months ago

On this image the extracted text is:

Why Rust?
Performance
[
Rust is blazingly fast and memory-
efficient: with no runtime or garbage
collector, it can power performance-
critical services, run on embedded
devices, and easily integrate with other
languages.
Reliability
Rust's rich type system and ownership
model guarantee memory-safety and
thread-safety  enabling you to eliminate
many classes of bugs at compile-time.
Productivity
Rust has great documentation, a friendly
compiler with useful error messages, and
top-notch tooling an integrated
package manager and build tool, smart
multi-editor support with auto-
completion and type inspections, an
auto-formatter, and more.

The spurious third line ("[") is coming from a broken mask where the word "is" is, in "Rust is blazingly...".