|
|
@@ -815,3 +815,23 @@ function nas() {
|
|
|
rclone mount --vfs-cache-mode writes --dir-cache-time 5s --no-check-certificate --allow-other nas: /home/mzunino/nas
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+function ocr(){
|
|
|
+ grim -g "$(slurp)" - \
|
|
|
+ | magick - -colorspace gray -negate -brightness-contrast 15x40 -sharpen 0x2 -threshold 60% - \
|
|
|
+ | tesseract stdin stdout -l eng+equ --psm 6 --oem 3 \
|
|
|
+ -c preserve_interword_spaces=1 \
|
|
|
+ -c tessedit_char_blacklist='‘’”“”´`–—•' \
|
|
|
+ | sed -E '
|
|
|
+ s/[“”]/"/g;
|
|
|
+ s/[‘’]/"/g;
|
|
|
+ s/’/'"'"'/g;
|
|
|
+ s/[éèê]/8/g;
|
|
|
+ s/í/i/g;
|
|
|
+ s/—/-/g;
|
|
|
+ s/“/"/g;
|
|
|
+ ' \
|
|
|
+ | wl-copy
|
|
|
+ notify-send "✅ OCR copied to clipboard"
|
|
|
+}
|