-
-
Save thingsiplay/5ff1718479ca49999f0d492cba0bcc66 to your computer and use it in GitHub Desktop.
ocr - select screen portion and recognize text from non text source such as videos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
input="$(mktemp)" | |
output="$(mktemp)" | |
import "$input.png" | |
tesseract -l eng "$input.png" "$output" 2> /dev/null | |
cat "$output.txt" | |
rm -f "$input" | |
rm -f "$input.png" | |
rm -f "$output" | |
rm -f "$output.txt" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a little and unspectacular script to read text from screen. It uses tesseract to ocr the text and import command from ImageMagick to make a screenshot. Then the script outputs the recognized text to stdout. You could replace the screenshot tool with something else you like, but the script expects the created files.