Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnnamedOCRVisualizerPort

A WIP experiment in making a small, portable OCR output visualizer.

Tesseract's eurotext.png A sha256sum wrapper function with bounding boxes.
Tesseract's eurotext.png A sha256sum wrapper

Requirements

So far:

  1. Love2D >= 12.0
  2. Tesseract for OCR

Optional Accessories

You can load arbitrary images if you have ImageMagick's magick command installed.

On Mac, homebrew should work. On Linux, your package manager should handle installing. For windows or more details, please see the ImageMagick download page.

Why?

  1. Lua-based applications:
    • are easier to ship
    • start and run faster than Python-based1 ones
  2. Refresh myself on Lua
  3. See how Love2D has progressed

What's Supported?

Goals include:

  • Word-level Tesseract-style TSV output
    • Minimal color mapping
    • System filepicker to choose files
  • Optional extended format support beyond default Love2D formats
    • Requires ImageMagick to be accessible via subprocess calls
    • Permits loading .webp, .avif, .tiff, and other formats (depends on your ImageMagick)
  • Character-level Tesseract mapping from the word-level (WIP)
  • Minimal UI:
    • Mouse-based gestures
    • Hot keys

XML-based ALTO may also happen, but it's not a priority given this is a port of an existing tool.

How do I use run.sh?

TL;DR: Install Love2D + Tesseract before ./run.sh

Important

VS Code can cause Love2D to launch with no window decorations! See VS Code Workaround for a fix.

Build Love2D 12.0's Pre-Release

Love2D's upcoming 12.0 release offers performance and API improvements even as an unfinished work in progress.

This means you currently have to build it from source to use this project. On Debian, you can use sudo ./get_deps.sh to get known build dependencies.

On other operating systems or Linux distros, you may need to consult the following:

On sufficiently Debian-like Linux, sudo ./get_deps.sh force may work. However, it's best to double check.

Add your Love2D v12.0 to $PATH

Once you've compiled, find the build/ folder in the cloned Love2D repo. Then do one of the following to add the new Love2D 12.0 to your PATH as love12.0

  • copy the file to install it
  • link it into a ~/bin folder
  • alias it in your .bashrc

Note

You can also skip ./run.sh and use your own build/runner script.

Building the .love file

The ./run.sh script auto-packages a .love file from the source folder.

$ ./run.sh

All arguments after are passed through directly.

VS Code Workaround

On some Linux systems running Wayland, VS Code can cause Love2D to launch with no Window decorations.

Console output will include the following:

libdecor-gtk-WARNING: Failed to initialize GTK
Failed to load plugin 'libdecor-gtk.so': failed to init
No plugins found, falling back on no decorations

As a workaround, you can launch VS Code with the following flags:

code --enable-features=UseOzonePlatform --ozone-platform=wayland

Future Considerations

You'll want to use the AppImage for Love2D 12.0 once it releases, especially on Debian.

This will ensure you avoid creating a FrankenDebian.

Footnotes

  1. Both CPython and Pillow can be fairly slow.

About

An OCR visualizer port from Python instead of a goose game

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages