These are the expected details about the quality and size of the images required to successfully capture an identity document:
Good lighting helps achieve better optical character recognition (OCR) results. If the image is too light or too dark, the document may not be processed correctly.
Highlights and reflections reduce the accuracy of data extraction during processing. We recommend not to use the flash of the mobile device to capture the document / s.
Focus and sharpness
Make sure the image is clear and there are no blurry areas.
The document tilt angle should not exceed 10 degrees in any direction (horizontal or vertical) so that distortion correction does not significantly harm the image quality.
Make sure there is a minimum space around the document and that it is completely inside the image, without touching the edges. It is recommended that the document occupy 70-80% of the image area (this is important, since even if the image is heavy,> 8MP, but after detection and cropping the document size is less than 640x480pixels, verification may not process correctly).
Too much margin
Make sure that the space around the document does not occupy more than 20-30% of the image. It is recommended that the document occupy 70-80% of the image.
Background with contrast
The document should be in clear contrast to the background. If the document is the same color as the background, the edges may not be detected. It is recommended to avoid light backgrounds if the document is light in color and dark backgrounds if the document is dark (that is, not white on white or black on black).
To ensure the quality of document recognition, it is recommended that the captured image be taken by a device with a resolution of at least Full HD (1920 × 1080) and autofocus. JPEG compression must not be less than 70% of the original.
Make sure that your hands or other objects do not partially or completely cover the document data.
If we have, for example, a 800 × 600 image from a webcam and we detect a document in it, it is very likely that the document does not occupy more than 80% of the area. If this webcam is a portable standard, it is most likely that it has a fixed (non-automatic) focus and that the document is not focused at this distance from the camera. In this case, keep in mind that if for a human eye is difficult to read it, the reliability of the OCR won’t be perfect.
If the document we are talking about is an identity card (TD1), its size is 86 × 54 mm. Let’s do the calculations: 800 pixels * 0.8 (80%) / 86 mm * 25.4 (mm per inch) = 189 PPI. Which would be below the limits of any OCR, since the font used, for example, in the German ID cards (TD2) is only 2 mm high, which would translate into 15 pixels, in which we should also consider JPEG compression loss and background noise.
To obtain the expected results, this image must be at least 300 PPI / 25.4 = ~ 12 pixels per mm (ppm) -> 86 mm * 12 ppm = 1032 pixels for the width of the document -> 1032 / 0.8 (80 %) = 1290 pixels for the width of the image, assuming that the document is perpendicular to the camera.
In the case of a passport (MRP) or visa (MRV) of 125 × 88 mm, we will consider 125 mm * 12pmm = 1500 pixels for the width of the document -> 1500 / 0.8 (80%) = 1875 pixels for the width from image.
However, MRTDs (Machine Readable Travel Documents) have MRZs (Machine Readable Zone) with lower resolution restrictions than those described if it is not necessary to compare data with the visual zone (VIZ) to check the integrity. In this case, an image of 800 × 600, will be recognized without failures in 90% of cases if all other requirements of image quality are met.
To summarize, it is recommended to obtain the images with a Full HD resolution camera (1920 × 1080) with autofocus for any size of identity document. Do not forget: