# Optical Character Recognition

## Overview

The OCR plugin allows you to run OCR on image assets in your project. The plugin will draw a bounding box around each OCR token, and add the recognized token text in the metadata of each box.

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-cover data-type="image">Cover image</th></tr></thead><tbody><tr><td align="center">Optical Character Recognition</td><td data-object-fit="contain"><a href="https://angohub-docs-assets.s3.eu-central-1.amazonaws.com/plugin-icons-banners/OCR.png">https://angohub-docs-assets.s3.eu-central-1.amazonaws.com/plugin-icons-banners/OCR.png</a></td></tr></tbody></table>

## Plugin Functionality

The Optical Character Recognition (OCR) Plugin automatically extracts text from images, converting it into structured annotations and add the recognized text in the metadata of the annotations. You can choose the level of detection (block, paragraph, line, or word) and specify the language for recognition.

<figure><img src="https://3895963154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTcOUG6rfWxqGM0N4db2P%2Fuploads%2FphnQ5DgVenWTEAcPctFC%2Fimage.png?alt=media&#x26;token=4575cc49-38da-4487-a3c7-d9e88dbc6b8c" alt=""><figcaption></figcaption></figure>

#### Supported Data Types <a href="#supported-data-types" id="supported-data-types"></a>

* Image

#### Supported Annotation Tools <a href="#supported-annotation-tools" id="supported-annotation-tools"></a>

* Bounding Box

### Plugin Configuration <a href="#plugin-configuration" id="plugin-configuration"></a>

The **Overwrite** setting in model plugins controls whether existing annotations are replaced or kept. When enabled, the plugin replaces all existing annotations with new model predictions; when disabled, it simply adds the new results without deleting what’s already there.

The **Class Mapping** setting defines how the model’s predicted classes are linked to your project’s label schema. Follow these steps to prepare your class mapping.

1. In the "Class Mapping" field, open the left dropdown, and pick from one of the classes the plugin can detect.
2. Open the right dropdown, and pick from one of the tools you have created in your project.
3. Click on the "plus" button to finalize the pairing. Now the object class and your bounding box tool are linked. The plugin will use the selected bounding box tool to label the selected category.
4. Starting again from Step 1, link as many tools to categories as needed.

<figure><img src="https://3895963154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTcOUG6rfWxqGM0N4db2P%2Fuploads%2FZ0GC4A1YyWocx29ft3QU%2Fimage.png?alt=media&#x26;token=29641d17-8be2-45bc-bb3f-d72c2b78bfbb" alt=""><figcaption></figcaption></figure>

You may vary a number of settings related to your export from the **Config JSON** field. Each option is detailed below:

```json
{
  "ocr_level": "paragraph",
  "selected_language": "eng"
}
```

* **"ocr\_level":** Defines the granularity of text extraction during OCR.
  * Options:
    * <kbd>"block"</kbd>
    * <kbd>"paragraph"</kbd>
    * <kbd>"line"</kbd>
    * <kbd>"word"</kbd>
  * Example:
    * <kbd>"ocr\_level": "paragraph"</kbd>

<figure><img src="https://3895963154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTcOUG6rfWxqGM0N4db2P%2Fuploads%2FPdtcfEjejk20qFjTzuDG%2Fimage.png?alt=media&#x26;token=bd8f4047-c32a-4f06-9b38-18a5cd113c82" alt=""><figcaption><p>Example results showing how OCR output varies by <kbd>ocr_level</kbd>. From left to right: <kbd>block</kbd>, <kbd>paragraph</kbd>, <kbd>line</kbd>, and <kbd>word</kbd>.</p></figcaption></figure>

* **"selected\_language":** Specifies the language used for OCR text detection and recognition. Accepts standard ISO language codes.
  * Options:
    * <kbd>"ara"</kbd>
    * <kbd>"deu"</kbd>
    * <kbd>"eng"</kbd>
    * <kbd>"fra"</kbd>
    * <kbd>"tur"</kbd>
    * ...
  * Example:
    * <kbd>"selected\_language": "eng"</kbd>
