Create braille diagrams from original image with OCR and manual touch ups.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Aamon Magnusson 6494e8fd54 grammar 7 months ago
done Initial commit 10 months ago
fonts Initial commit 10 months ago
ocr-json-common Initial commit 10 months ago
src Update tables 10 months ago
.gitignore Add .gitignore 10 months ago
Cargo.lock Initial commit 10 months ago
Cargo.toml Initial commit 10 months ago
LICENSE Initial commit 10 months ago grammar 7 months ago added 7 months ago Initial commit 10 months ago

OCR Braille Diagram Tools

This tool should not exist. And it also doens't work very well. BUT, it has a few, limited, useful cases.

Here is the basic idea: import an existing diagram of some kind and use OCR+manual touch ups to have appropriate highlights and text values. Then, whiteout existing text and replace it with braille. This is an arduous, annoying process, but it can be useful in rare cases.


  • python (3.8+)
    • louis (in requirements.txt)
  • libouis (from package manager)


Use ./ The file must be called diagram.png in the same directory as the file. The generated file will be called out.png.

Generate OCR Data

./ gen-ocr

This creates an out.json file with all OCR data.

Show OCR Detection Boxes

./ show-labels

This writes to the out.png file with OCR boxes highlighted in red, using the out.json file to create the highlights. The highlight box has the number on the left of it, that is the box ID. This is important for later.

Editing Data

Open out.png in an image viewer which will automatically update when the file is written to. When any of these commands are run, the out.png file will be rewritten with the new data.

./ edit-json
# merges boxes 1 and 2, from smallest (x,y) to largest (x+w,y+h)
# split box 3 vertically in two
# split box 7 horizontally in two
# show raw JSON data of box 9
# change text of box 1 to "hello world"
text|1|hello world
# add new box at (420,69) with width of 80, height of 150
# add 10px width/height to the left/right/top/bottom of box 1
# remove 15px width/height to the left/right/top/bottom of box 3
# move box 1 left/right/up/down by 8px
# remove box 6
# save data to `out.json`
# exit program

Whiteout Existing Text

./ whiteout

This will rewrite out.png with an image that has all the boxes defined in out.json replaces by entirely white pixels.

Add Braille To Diagram

./ add-braille

This will rewrite out.png with braille text at the position of all the OCR objects in out.json.

The script builds on top of the, making it more like a menu. Ensure the file you want to work with is called diagram.png, and that the extra dependencies are fulfilled, and run:

./ dependencies

  • convert
  • nvim
  • sxiv


See the /done directory for examples of OCR, pngs at various states of done-ness and the final version. Most of these have a massive fault: the braille font is NOT the right size and is not readable.

But it should give you an idea of how to use the tool.


If you'd like to contribue, please use the Github repo unless you work with Bytetools and have permission.