Created
March 6, 2023 02:18
-
-
Save abserari/a3142df43a575ec46d98c55a8dc6c730 to your computer and use it in GitHub Desktop.
Kubuntu use OCR: https://www.reddit.com/r/Kubuntu/comments/11dut0s/kubuntu_use_ocr/
This file contains hidden or 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 | |
# Dependencies: tesseract-ocr flameshot imagemagick xclip | |
#Name: OCR Picture | |
#Fuction: take a screenshot and OCR the letters in the picture | |
#Path: /home/Username/... | |
#you can only scan one character at a time | |
SCR="/home/Username/pictures/SCR" | |
mv $SCR.png $SCR.prev.png | |
# take a shot what you wana to OCR to text | |
flameshot gui -p $SCR.png | |
# increase the png | |
mogrify -modulate 100,0 -resize 400% $SCR.png | |
# should increase detection rate | |
# OCR by tesseract | |
tesseract $SCR.png $SCR &> /dev/null -l eng+chi_sim | |
# get the text and copy to clipboard | |
cat $SCR.txt | xclip -selection clipboard | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment