aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/misc/ocr
diff options
context:
space:
mode:
authorHsieh Chin Fan <typebrook@gmail.com>2021-05-10 08:24:39 +0800
committerHsieh Chin Fan <typebrook@gmail.com>2021-05-10 08:24:39 +0800
commit2d92c8d8846ad77a9a0385afec0432563c970ad1 (patch)
treec70040aa4794766efdadfb0c484d59d9609b0977 /tools/misc/ocr
parent4a81e91f02e400d34aeedc9d2ae9e8013696f2d7 (diff)
update
Diffstat (limited to 'tools/misc/ocr')
-rwxr-xr-xtools/misc/ocr16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/misc/ocr b/tools/misc/ocr
new file mode 100755
index 0000000..26594fe
--- /dev/null
+++ b/tools/misc/ocr
@@ -0,0 +1,16 @@
1#!/bin/bash
2# Dependencies: tesseract-ocr imagemagick scrot xsel
3
4SCR_IMG=`mktemp`
5trap "rm $SCR_IMG*" EXIT
6
7scrot -s $SCR_IMG.png -q 100
8# increase image quality with option -q from default 75 to 100
9
10mogrify -modulate 100,0 -resize 400% $SCR_IMG.png
11#should increase detection rate
12
13tesseract $SCR_IMG.png $SCR_IMG &> /dev/null
14cat $SCR_IMG.txt | trans -t zh-TW --brief --engine bing | cat $SCR_IMG.txt - | tr '\n' ' ' | xargs -I{} notify-send --urgency=critical translation '{}'
15
16exit