From 6fae25b305d714b3ab7608fa003f1af9bf024545 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Tue, 14 Feb 2023 13:33:23 +0800 Subject: Rename tools into bin --- bin/misc/ocr | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/misc/ocr (limited to 'bin/misc/ocr') 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 @@ +#!/bin/bash +# Dependencies: tesseract-ocr imagemagick scrot xsel + +SCR_IMG=`mktemp` +trap "rm $SCR_IMG*" EXIT + +scrot -s $SCR_IMG.png -q 100 +# increase image quality with option -q from default 75 to 100 + +mogrify -modulate 100,0 -resize 400% $SCR_IMG.png +#should increase detection rate + +tesseract $SCR_IMG.png $SCR_IMG &> /dev/null +cat $SCR_IMG.txt | trans -t zh-TW --brief --engine bing | cat $SCR_IMG.txt - | tr '\n' ' ' | xargs -I{} notify-send --urgency=critical translation '{}' + +exit -- cgit v1.2.3-70-g09d2