# EasyOcr2Read

| Support            | ![](assets/images/sample_programs/applies_to/cpp.svg) ![](assets/images/sample_programs/applies_to/cs.svg) ![](assets/images/sample_programs/applies_to/qt.svg) ![](assets/images/sample_programs/applies_to/vb.svg) ![](assets/images/sample_programs/applies_to/python.svg)   |
|--------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Required licenses  | **EasyOCR2**                                                                                                                                                                                                                                                                    |
| Recommended images | Any image from the folder `Sample Images/EasyOCR2`                                                                                                                                                                                                                              |
| Location           | `Text and Code Reading/EasyOcr2Read` and `Console samples/Text and Code Reading`                                                                                                                                                                                                |

## Purpose

This sample program demonstrates how to:

- Read a text inside the ROI of an image.

![](assets/images/sample_programs/text_and_code-easyocr2read.webp)

## Code highlights

1. Load the model file including the parameters about the text to read.
   ```c++
   m_OCR2.Load(ToUtf8(LoadFont.GetPathName()).GetString());
   ```
2. Read the text present in the ROI of the image.
   ```c++
   m_ReadText = m_OCR2.Read(m_Roi);
   ```
3. Draw the blob candidates on the image.
   ```c++
   OCR2.DrawSegmentation(drawAdapter, EasyOCR2DrawSegmentationStyle_DrawBlobs, 1.0, 1.0, 0, 0);
   ```
4. Draw the detected character boxes on the image.
   ```c++
   OCR2.DrawDetection(drawAdapter, EasyOCR2DrawDetectionStyle_DrawChars, 1.0, 1.0);
   ```
5. Draw the recognized character next to each character box on the image.
   ```c++
   OCR2.DrawRecognition(drawAdapter, EasyOCR2DrawRecognitionStyle_LeftTop, 15, 1.0, 1.0);
   ```
