aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin/misc/ocr
diff options
context:
space:
mode:
Diffstat (limited to 'bin/misc/ocr')
-rwxr-xr-xbin/misc/ocr16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/misc/ocr b/bin/misc/ocr
new file mode 100755
index 0000000..26594fe
--- /dev/null
+++ b/bin/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