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.
It segments pixels then detects text blobs and sets textboxes over the detected blobs following a user-defined topology.
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.
Workflow¶
Learning Mode¶
Production Mode¶
Reading a Text¶
Create an
EOCR2.NET Python object, configure the detection parameters or load a model file withEOCR2::Load.NET Python.Call
EOCR2::Read2.NET Python to read the text in an image.
#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¶
Learn how to use EasyOCR2.
Learn how to correctly setup the parameters of EasyOCR2.
Quick Links¶
List of all Classes, Structs and Enumerations of the EasyOCR2 library.
Code snippets for the EasyOCR2 library.
See also
Some eVision Studio samples illustrate several aspects of the EasyOCR2 library:
EasyOCR2 text reading with a database classifier: Uses EasyOCR2 to loads an image and uses a character database to read it.EasyOCR2 text reading with a deep learning recognizer: Uses EasyOCR2 to loads an image and uses the deep learning recognizer ‘Industrial’ to read it.