The Tesseract API allows connected clients to perform OCR operations using Tesseract on the gateway. For this to work, the Tesseract OCR application must be installed on the same machine as the IoT Gateway. If installing the API via the Tesseract package, the Tesseract program application will be installed with package. Otherwise, the application can be downloaded via the links below, and installed manually.
To access the API, the client needs to authenticate itself. This is done using WWW-Authenticate
in the HTTP request. The client can choose to provide credentials that match a user on the gateway, or a Bearer-token containing a JWT-token issued by the gateway, to gain access to the OCR api. No special privileges are required.
OCR is performed, by sending a POST
request to /Tesseract/Apí
with an image as content. The image will be sent to the Tesseract application, and the text result will be returned as plain text. You can affect how OCR is performed by adding the following optional HTTP headers to the request:
HTTP Header | Description |
---|---|
X-LANGUAGE | Language to expect in image. |
X-PSM | Page Segmentation mode. Possible values: DetectOrientationAndScript , AutomaticPageSegmentationWithOsd , AutomaticPageSegmentationNoOsdOrOsr , FullyAutomaticPageSegmentationd , SingleColumnOf , SingleUniBlockOfVerticallyAlignedText , SingliformBlockOfText , SingleLineOfText , SingleWord , SingleWordInCircle , SingleCharacter , SparseText , SparseTextWithOsd , RawLine |
Any images send to the API for OCR will be stored on the gateway for up to 7 days, for troubleshooting and security purposes. They are automatically deleted when the time interval elapses.
The Tesseract API can be installed from the free package Tesseract.package
with the following key: AjJrr5WaqpfJoykYUQBy7jq7n/GGVHx0L8pPtl4HJzb+Fi37VN8Rh1+Oo8jhz4kA96+DhxHb7gOA72865450fe7caf4d3ebff9b91e3f7073
.
Following are some Tesseract-related reference links that may be of interest: