New filter in the Scanner App Docutain
September 28, 2022 by Simeon

How a new scan filter was developed in the Docutain Scanner App

Working student Simeon reports on the development of the "Illustration" filter

You may have already noticed our filter, which can be found under the name "Illustration" in Docutain. In this article, we would like to tell you what Docutain's filters are all about, how they work and, of course, what's behind the new filter.

Check out our Docutain SDK
Integrate high quality document scanning, text recognition and data extraction into your apps. If you like to learn more about the Docutain SDK, contact us anytime via

The task of the filters

When you use your smartphone to photograph documents to digitize them, it is of course extremely practical in the first place. You always have it with you, and you can then send the document directly via your smartphone or archive it in the document management app Docutain. Using bulky and stationary document scanners is quite different.

However, simple document photos have one disadvantage: they are usually not perfectly illuminated. Anyone who regularly photographs documents is probably familiar with this. It's too dark in the room, the paper doesn't lie flat, or the smartphone casts a shadow on the document... With classic document scanners, things are usually easier. You place the document in the scanner and press it flat with the flap at the latest. The scanner then illuminates the document brightly and evenly from close range. The result is a perfectly illuminated scan, which should look something like a digital version of the document on the computer.

Of course, we would also like to achieve this level for our mobile scans on the smartphone with Docutain. Admittedly, scans usually look more professional and easier to read than, for example, photos taken under the light of a desk lamp. This is exactly where our filters in Docutain come in. The goal is that they filter the document photo so that they are on the same level as classic document scans. Or better yet, that they look like the original document in digital form.

This is not always an easy task, as we want to remove a wide range of lighting artifacts or even damage to the document. These include uneven illumination, shading, shadows, or color casts, as well as wrinkles, creases or stains on the document:

common lighting artifacts like color casts, shadows or darkening shades
Common lighting artifacts such as color casts (left, among others), shadows (center) or darkening shades (right).

How do the scan filters work?

In principle, the filters work via various methods of image processing.

The general idea is that it is necessary to recognize which structures in the photo are due to the content of the document. To do this, the lighting effect is usually estimated and then extracted from the original photo so that only the content is visible. If everything worked correctly in the estimation, shading, shadows, and color casts are removed and the document is illuminated evenly, sufficiently and in neutral color:

Photos with lighting calculated out
Photos with lighting calculated out

The difficulty is mainly the correct estimation of the illumination. There are certain assumptions about the size and structure of printed content and the illumination. It is relatively easy with text-only documents, for example, because the text there is usually rather small and has pronounced margins. The illumination tends to be more characterized by smooth and large-scale gradients. With suitable image processing methods, the text can thus be removed from a document photo so that only the illuminated, blank sheet remains. From this, the estimated illumination can be directly derived for monochrome paper.

Before and after comparison filter
The original photo (left), the estimated lighting without text (center) and the corrected document (right).

Unfortunately, it's not always that simple, and so there are many scenarios in which these assumptions don't quite apply. Strong shadows are often still a problem, as are illustrated documents that contain not only text but also, for example, photos, diagrams, or larger design elements. Especially the latter can take any shape and are much less predictable than text. So, it can happen that shadows are recognized as part of the document and are not factored out, or that a photo on the document is recognized as an illumination artifact and is damaged accordingly.

What is the new filter for?

Our previous filters often led to incorrect corrections in illustrated documents, which mainly lightened larger illustrations too much and made them look not quite true to the original.

This is where we started, because in addition to the reduced aesthetics of the scan, there may well be important information in the illustrations that could possibly be lost through unsuitable filtering. For the new filter, we therefore looked at many ways of removing the illumination artifacts without damaging the illustrations.

The result is a filter that makes illustrations look much more natural than in our previous filters and still masters the removal of lighting artifacts with flying colors. The focus is on documents made of white paper, since the illumination estimation works well especially in this case. If the documents are on colored paper, the filter still provides a visually improved appearance with stronger contrasts:

Result of the new filter for illustrated document
Result of the new filter for illustrated document

We are also particularly proud of the fact that the filters deliver results for illustrated documents that are currently not possible with our competitors. The example below shows the comparison to Adobe Scan and Microsoft Lens document filters:

Competitor comparison filters
Original photo, Docutain, Adobe Scan, Microsoft Lens (from left to right)

All in all, it is still very difficult to deliver perfect results for every document in every lighting situation. Therefore, in very difficult scenarios, it can still happen that you must do some touch-ups yourself and, for example, provide better illumination.

We are convinced that we could bring your smartphone even closer to the quality of conventional document scanners with our new filter. Why don't you try out our new filter and see for yourself!

Check out our Docutain SDK
Integrate high quality document scanning, text recognition and data extraction into your apps. If you like to learn more about the Docutain SDK, have a look at our Developer Documentation or contact us anytime via

Your contact to Docutain

Please tell our colleague Harry Beck how the Docutain SDK can help you with your project. We are looking forward to receiving your inquiry, either by telephone or contact form.