The Anyline Document Module detects document outlines, validates the angles of the document to ensure it is not too skewed, validates the document ratio, determines the sharpness of the text and rectifies the document.
In the first step the preview frames are analyzed. Once a valid and sharp document is detected, a high resolution image is taken from the camera, analyzed, and, if valid and sharp, perspectively corrected and cropped to the document bounds.
The module does not perform the OCR step, but instead provides a high resolution, perspectively transformed and rectified, cropped document image, which is ensured to hold sharp text.
Simultaneous Barcode Scanning
Starting from SDK 3.8 Anyline supports simultaneous barcode scanning for any module. Additional Information can be found under Simultaneous Barcode Scanning
As of version 3.11, the Document Module is limited to Portrait Mode
- iOS: Document Module
- Android: Document Module
- Cordova: Set the Scan Mode
- Xamarin.iOS: Implementing Anyline
- Xamarin.Android: Adding the Module and configure it
A couple of different examples can be found at Anyline Demos and Samples: Document.
In the first step, the Document Module processes the preview frames from the camera, and performs all the checks and detections listed in the next section.
If the quality criteria is fullfilled, a full picture is taken from the camera (also referred to as fullFrame throughout this documentation), and further processed.
Full Frame Processing
If the preview was successful, a full picture in the desired pictureResolution is taken, and all the checks and detections listed in the next section are performed on the full picture again.
If these are passed, the cropped and perspectively transformed image is returned as a result.
Checks & Transformations
The Document Module performs a couple of checks on the input image to ensure the quality of the result. It also performs transformations on the image, which results in a perspectively corrected and cropped output image, containing only the document.
The outline of the document is detected within the image. Therefore the contrast between the document and the background should be as high is possible.
Starting with version 3.8 of the SDK, you can set the desired document ratio(s) in your implementation. The detected documents are then limited to the ratios you provide (plus some deviation). Other ratios are considered incorrect.
One donkey ear is allowed in the document. If there is a donkey ear present, the sides of the document are interpolated to form a new corner for the cropped image.
Anyline SDK prior 3.8
In SDK versions before 3.8, the document ratio was limited to documents in the DIN A standard. Also, the donkey ears detection was not present.
The Document Module checks if the document is not too skewed. This is performed by a check on the interior angles of the outline of the document. If the angle is too high, the Perspective Transformation & Crop is likely to ruin the Sharpness Detection of the document because of pixel interpolation.
Perspective Transformation & Crop
Once a valid outline is detected, the document is perspectively transformed. This results in the document being displayed as if the camera was placed directly above the document.
The image is cropped as well, leaving only the document bounding box in the image.
3.8.0 Android x86
As of version 3.8.0, the Document Scanner does not work on x86 Android devices, and will report Document Not Sharp. This is due to a limitation in a 3rd party library. This was fixed in version 3.9.0
3.8.0 Cordova Android Camera 2 API devices
As of version 3.8.0, the Document Scanner on Cordova Android does not support the Camera 2 API. This can be avoided with by adding
app:api_2_enabled="false" to the
scanView in the layout file. This was fixed in version 3.9.0.