This module defines the Emacsvox front end to OCR. PaddleOCR PP-StructureV3 is the default engine and accepts images and PDFs. SANE remains available as an optional image-acquisition route.
Open the Emacsvox front end for image and PDF OCR. The selected file is run through ‘emacsvox-ocr-engine’ and the result is placed in a buffer suitable for reading and saving. Optional image acquisition commands use tools from the SANE package. For detailed help, invoke command emacsvox-ocr bound to C-e C-o to launch emacsvox-ocr-mode, and press ‘?’ to display mode-specific help for emacsvox-ocr-mode.
Like backward page, but tracks page number of current document. (fn &optional COUNT-IGNORED)
Run OCR engine on current image after flip-flopping it. Useful if you’ve scanned a page upside down and are using an engine that does not automatically flip the image for you. You need the imagemagik family of tools — we use mogrify to transform the image. Prompts for image file if file corresponding to the expected ‘current page’ is not found.
Like forward page, but tracks page number of current document. (fn &optional COUNT-IGNORED)
An OCR front end for the Emacsvox desktop. The default engine is PaddleOCR PP-StructureV3. It recognizes images and PDFs, preserves reading order, and represents detected tables in Markdown. Install it as described in the Emacsvox user manual, then use ‘o’ to choose a file. OCR runs asynchronously; engine diagnostics go to the buffer named by ‘emacsvox-ocr-error-buffer’. The optional scanner commands require a working scanner back end such as SANE on Linux. ‘emacsvox-ocr-scan-image’ uses ‘scanimage’ to acquire a TIFF file; customize ‘emacsvox-ocr-scan-image’ and its related options if necessary. Launch this front end with ‘emacsvox-ocr’, bound to C-e C-o. The result buffer uses single-keystroke commands; see the key-binding list below. Recognized text and optional acquired images are saved under ‘emacsvox-ocr-working-directory’. Command ‘emacsvox-ocr-open-working-directory’, bound to M-x emacsvox-ocr-open-working-directory, opens that directory. By default, the document is named from the current date. You can name the document by using command emacsvox-ocr-name-document bound to M-x emacsvox-ocr-name-document. The document name is used in constructing the name of the image and text files. Key Bindings: See Key Binding ——————————————————————————- RET emacsvox-ocr-scan-and-recognize SPC emacsvox-ocr-read-current-page 1 .. 9 emacsvox-ocr-page ? describe-mode C emacsvox-ocr-set-compress-image-options I emacsvox-ocr-set-scan-image-options [ emacsvox-ocr-backward-page ] emacsvox-ocr-forward-page c emacsvox-ocr-customize d emacsvox-ocr-open-working-directory f emacsvox-ocr-flipflop-and-recognize-image i emacsvox-ocr-scan-image j emacsvox-ocr-scan-photo n emacsvox-ocr-name-document o emacsvox-ocr-recognize-file p emacsvox-ocr-page q bury-buffer s emacsvox-ocr-save-current-page w emacsvox-ocr-write-document . In addition to any hooks its parent mode ‘text-mode’ might have run, this mode runs the hook ‘emacsvox-ocr-mode-hook’, as the final or penultimate step during initialization.
Name document being scanned in the current OCR buffer. Pick a short but meaningful name. (fn NAME)
Launch dired on OCR working directory.
Speaks current page.
Run the OCR engine asynchronously on image or PDF INPUT-FILE. (fn INPUT-FILE)
Compatibility command that recognizes an image or PDF.
Writes out recognized text from current page to an appropriately named file.
Scan in a page and run OCR engine on it. Use this command once you’ve verified that the separate steps of acquiring an image and running the OCR engine work correctly by themselves.
Acquire a page image, publishing it only after successful processing. With compression and ‘emacsvox-ocr-keep-uncompressed-image’, retain the original with -uncompressed before its extension. On processing failure, report the recovery path and leave the page number unchanged.
Scan in a photograph. The scanned image is converted to JPEG. (fn &optional METADATA)
Interactively update image compression options. Prompts with current setting in the minibuffer. Setting persists for current Emacs session. (fn SETTING)
Command used to compress the scanned tiff file.
Default Value:
nil
Options used for compressing tiff image.
Default Value:
"-c g3 "
Options used when created JPEG from scanned photographs.
Default Value:
"-optimize -progressive"
OCR engine used to process an image or PDF.
Default Value:
"<emacsvox-root>/bin/emacsvox-paddleocr"
Additional command-line arguments passed literally to the OCR engine. For the bundled PaddleOCR adapter, these follow the typed customization options and can override them.
Default Value:
nil
Buffer that receives diagnostics from the OCR engine.
Default Value:
"*Emacsvox OCR Errors*"
Filename extension used for acquired image.
Default Value:
".tif"
Program to add metadata to JPEG files.
Default Value:
"wrjpgcom"
If set to T, uncompressed image is not removed.
Default Value:
nil
Paddle device used by the bundled adapter. Examples include ‘cpu’, ‘gpu’, and ‘gpu:0’.
Default Value:
"cpu"
Whether to enable oneDNN/MKL-DNN acceleration for PaddleOCR. Keep this disabled for the tested PaddlePaddle 3.3.0 CPU setup on WSL.
Default Value:
nil
Language used by the bundled PaddleOCR adapter.
Default Value:
"en"
Python executable used by the bundled PaddleOCR adapter. When nil, the launcher uses its default isolated environment. This option has no effect when ‘emacsvox-ocr-engine’ selects another OCR engine.
Default Value:
nil
Whether PaddleOCR should classify document orientation.
Default Value:
t
Whether PaddleOCR should correct warped document images.
Default Value:
t
Whether PaddleOCR should recognize mathematical formulas.
Default Value:
t
Whether PaddleOCR should recognize and preserve tables.
Default Value:
t
Whether PaddleOCR should classify individual text-line orientation.
Default Value:
t
Program to create JPEG compressed images.
Default Value:
"cjpeg"
Command line options to pass to image acquisition program.
Default Value:
"--resolution 300 --mode lineart --format=tiff"
Options used when scanning in photographs.
Default Value:
"--mode color --format=pnm"
Directory where images and OCR results will be placed.
Default Value:
"~/.emacsvox/ocr/"