Initialize an OCR engine.
This will start a Worker in which the OCR operations will actually be performed.
Clear the current image and text recognition results.
This will clear the loaded image data internally, but keep the text recognition model loaded.
At present there is no way to shrink WebAssembly memory, so this will not return the memory used by the image to the OS/browser. To release memory, the web worker needs to be shut down via destroy.
Perform layout analysis on the current image, if not already done, and return bounding boxes for a given unit of text.
This operation is relatively cheap compared to text recognition, so can provide much faster results if only the location of lines/words etc. on the page is required, not the text content.
Perform layout analysis and text recognition on the current image, if not already done, and return the image's text in hOCR format (see https://en.wikipedia.org/wiki/HOCR).
Attempt to determine the orientation of the image.
This currently uses a simplistic algorithm [1] which is designed for non-uppercase Latin text. It will likely perform badly for other scripts or if the text is all uppercase.
[1] See http://www.leptonica.org/papers/skew-measurement.pdf
Perform layout analysis and text recognition on the current image, if not already done, and return the image's text as a string.
Perform layout analysis and text recognition on the current image, if not already done, and return bounding boxes and text content for a given unit of text.
Load an image into the OCR engine for processing.
Load a trained model for a specific language. This can be specified either as a URL to fetch or a buffer containing an already-loaded model.
Generated using TypeDoc
High-level async API for performing document image layout analysis and OCR.
In the browser, this class can be constructed directly. In Node, use the
createOCRClient
helper fromnode-worker.js
.