EasyOCR2 - Reading Complex Texts

Purpose

EasyOCR2 is an optical recognition tool designed to read short texts such as serial numbers, expiry dates or lot codes printed on labels or on parts.

Source image

It segments pixels then detects text blobs and sets textboxes over the detected blobs following a user-defined topology.

Image segmentation
Textboxes fitting

The topology specifies the number of lines, words and characters in the text. You can also specify a character type (letter, digit and/or symbol) for each character in the text, to improve the recognition rate and speed.

EasyOCR2 supports up-to-360-degree rotated texts, non-uniform illumination and textured backgrounds as well as dot-printed or fragmented characters.

To recognize characters, EasyOCR2 uses a pretrained classifier, powered by deep learning technologies, or a classifier that was trained on your character database.

For each input character:

  • The classifier calculates a score for all candidate outputs.

  • It returns the candidate with the highest score as the recognition result.

Text recognition

Workflow

Learning Mode

Production Mode

../../../_images/workflow_production.svg

Reading a Text

#include <eVision/EasyOcr/EasyOCR2/EOCR2.h>
using namespace eVision;
// Load an image
EImageBW8 image;
image.Load("image.tif");
// Attach an ROI
EROIBW8 roi;
roi.Attach(&image, 50, 224, 340, 96);
// Create an EOCR2 instance
EOCR2 ocr2;
// Load a pre-made model file, this will:
// - (re)set all parameters
// - add the character database in the model file to the EOCR2 instance
ocr2.Load("myModel.o2m");
// Read text from the image
EOCR2Text result = ocr2.Read2(roi);
using eVision;
// Load an image
EImageBW8 image = new EImageBW8();
image.Load("image.tif");
// Attach an ROI
EROIBW8 roi = new EROIBW8();
roi.Attach(image, 50, 224, 340, 96);
// Create an EOCR2 instance
EOCR2 ocr2 = new EOCR2();
// Load a pre-made model file, this will:
// - (re)set all parameters
// - add the character database in the model file to the EOCR2 instance
ocr2.Load("myModel.o2m");
// Read text from the image
EOCR2Text result = ocr2.Read2(roi);
import eVision
# Load an image
image = eVision.EImageBW8()
image.Load("image.tif")
# Attach an ROI
roi = eVision.EROIBW8()
roi.Attach(image, 50, 224, 340, 96)
# Create an EOCR2 instance
ocr2 = eVision.EOCR2()
# Load a pre-made model file, this will:
# - (re)set all parameters
# - add the character database in the model file to the EOCR2 instance
ocr2.Load("myModel.o2m")
# Read text from the image
result = ocr2.Read2(roi)

Contents

Using EasyOCR2

Learn how to use EasyOCR2.

Using EasyOCR2
Setting The Parameters

Learn how to correctly setup the parameters of EasyOCR2.

EasyOCR2 Advanced Parameters