> For the complete documentation index, see [llms.txt](https://cartoonmango-1.gitbook.io/vida-ekyc-integration/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cartoonmango-1.gitbook.io/vida-ekyc-integration/integration-methods/api/ocr.md).

# OCR

The VIDA OCR API allows you to extract information from a user's KTP (Kartu Tanda Penduduk) card image using OCR (Optical Character Recognition) technology. This process involves analyzing the image and identifying the relevant text and data present on the KTP card.

When you submit a request to the OCR API, the system starts processing the image to extract information such as the person's name, address, date of birth, gender, marital status, nationality, identification number, occupation, and other details printed on the KTP card.

#### Image Specification

Prior to performing character recognition, the VIDA OCR system undergoes image pre-processing to ensure optimal text recognition accuracy. This includes evaluating the image size and resolution to meet specific requirements. The system checks that the KTP object within the image has dimensions greater than or equal to 300 x 400 pixels. Additionally, the file size of the image should not exceed 2 MB.<br>

| Image Setting                    | Requirement                                                                    |
| -------------------------------- | ------------------------------------------------------------------------------ |
| Minimum camera pixel             | Above 2 MP                                                                     |
| Image file size                  | <p>Minimum size: 100 KB</p><p>Maximum size : 2 MB</p>                          |
| Image Compression Recommendation | Bicubic, with minimum JPEG quality 80%                                         |
| Image Dimension                  | <p>Minimum Dimension : 300 x 400 px</p><p>Maximum Dimension : 4000x3000 px</p> |

### Key Image Quality Recommendations for OCR Data Extraction

#### Horizontal Orientation&#x20;

OCR data extraction in the VIDA OCR system is specifically designed to recognize text that is horizontally oriented on the KTP card. To ensure accurate extraction of data, it is important that the document image is horizontally aligned and not rotated.<br>

![](https://lh5.googleusercontent.com/OvSmMxQjoRgfGBDyQhXM4OHMaAR_AIeWZo4K2SGEdnJeNa2DawZJBmNYt8b8FMhKkuqefrcfuZwfX32_jkPp-Cw175Zx4HzPC43yvP5E591iYsSpcIs1F_xOZBfl4bgiyn4g25c9Y5xkbihObnpmRAk)&#x20;

![](https://lh4.googleusercontent.com/wZTkHIPxqY_lfuyK4r4mPKQ-1HkVPTaTMWTB7t1338Dt6ABVnUoTdef7Ufm_0vPD9GydfGhceUrNJP_PDVd9TlpdiD90VUr54D5IM8CdXWA2YvU8-TS4PuLWmrNCgKWG6Vjg6j1wqJHM3zX9MZszE70) ![](https://lh6.googleusercontent.com/IvDrOUURGDzcgxyDHLRKUcSuAivfRzeHGAWgaMn68I0JSgBBxNOU10Ks1hjR4vxW93YdMuWgv8ow323gUbU-E7SSfAoYVzAwGWtOltYdo5St0WdpvZYahr3bONtXdWfDZQ4bK7vG2h4DuSe8L8f4oLc)

#### Proper Document Positioning

For optimal OCR data extraction, it is crucial to have a well-positioned document image where the KTP object is clear and easily recognizable. If the KTP object within the image is too distant or unclear, it can adversely affect the system's ability to accurately detect and extract the text, potentially leading to errors in data extraction.

![](https://lh4.googleusercontent.com/MlVCg8zrZr4c9OUGbhOYKA0yCdvmo-xpS55PFlXkk5R_6sSpIw6aqtbE15NRInBuBNnBBB-BGvv_znP0tI-saxEhctA91tbN53KUe7JQRxe1FxUaJJKUZ6kusD0KkmmPDAx9atS-xea19s04s_Lt9HU) ![](https://lh3.googleusercontent.com/R5Y7Mhdhxx2DViZ4iQEHicrod6dVecfj6aSEE7fR4raLrgeBj-hk0YxSwD45D_jZpRT-z6NB5-TZT7OKuAjnrTMl3zD-msaDByM-OA6vNiubRsZel93vbDKyEKj7uchz2Gb14l2q9fOJxpvEfyjrbBs)

#### Adequate Lighting

In order to achieve accurate text recognition, it is essential to capture document images in adequate lighting conditions. Low lighting conditions can pose challenges for the OCR system to accurately recognize text. Therefore, it is highly recommended to capture document images in good lighting conditions to ensure clear and easily recognizable text.

![](https://lh3.googleusercontent.com/tzLXeFFraAoAgSxLoVjI8WCT00UukNx212SxC6npwzMWfo9WqcCw4Bcrz8qs8Bo6AJKIi5tq5EN8S-jtjOXkrfZD0jkrrqolgT6of9MRLlX3j1MXK8m9YaRIAP28O5rPh-4Ba88wUOinDnLd8I37bgY)

#### Avoid Glare&#x20;

Glare on the document can interfere with text recognition and lead to errors in data extraction. It is important to avoid glare by taking the document image in an environment with minimal light reflection.

![](https://lh3.googleusercontent.com/pt4DQgCIIabLcWZ4uWqdTs9FKVT4Q3yTb5sEu9TeFWx_P6-7hXwHpWlFhGGipYv_IkLO6SnLU9T6U7wGTxG6H3CShfwemKBLolLZ7X2vf-d59OPhi7y-TXv8etwdqZ3QJQWcQZbCa9c4Oewy2QfTWPg)

#### Avoid Defects

Defects in the document image, such as folds, creases, or stains, can interfere with OCR text recognition and lead to errors in data extraction. It is recommended to ensure that the document is clean and free of any defects before scanning or taking the image.

![](https://lh4.googleusercontent.com/-gLKAe7XZSkUEcH4gu-U9knvIZcqJ8SHbScZN3cz3rtGJoWJtmYRy17fF0fBEE-kS5R-TkHq0-09AfMoL2wHYjeNXcjT-qZxDVe9OWej3oUozwEFtgscPeEmFeXWWoyJPLP-GQxEkzw0IosNxEZ5W0U)

## Error Handling

The error response will consist of:&#x20;

* code: represent the unique of the error code
* title: the response information
* detail: the description of the error

Incase of errors the API would returnHTTPStatus with the following response body

```json
{
  "errors": [
    {
      "code": 0,
      "detail": "string",
      "title": "string"
    }
  ]
}
```
