The Anyline Document Plugin 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 plugin 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.
As of version 3.11, the Document Plugin is limited to Portrait Mode
- iOS: Document Plugin
- Android: Document Plugin
- Cordova: Add the Anyline SDK Plugin to your Project
- React-Native: Add the Anyline SDK Plugin to your Project
- 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.
Automatic Scanning Process
In the first step, the Document Plugin 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 camera.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 Plugin 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.
New in version 3.17.
The SDK offers the ability to manually trigger a corner detection of the document in the image, and to manually trigger a perspective transformation, without the checks performed in Preview Processing and Full Frame Processing.
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 Plugin 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.
Maximum Output Resolution
New in version 3.19.
The SDK offers the ability to limit the maximum output resolution of the processed and transformed image.
New in version 3.24.
The SDK offers the ability to post process the detected document. In particular, the software adjusts the colors so that the image looks natural. The SDK adjusts the colors so that the brightest color is white and the darkest black. This technique is also known as white balance.
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.