Back to Adaptive Vision Library website

You are here: Start » Function Reference » Optical Character Recognition » ReadText

ReadText


Header:AVL.h
Namespace:avl

Ready-to-use tool for reading text from images using the OCR technique.

Syntax

C++
C#
 
void avl::ReadText
(
	const atl::Array<avl::Region>& inCharacters,
	const avl::OcrModel& inOcrModel,
	const float inMinScore,
	atl::String& outText,
	atl::Array<atl::Conditional<atl::String>>& outCharacters,
	atl::Array<float>& outScores,
	bool& outIsTextValid
)

Parameters

Name Type Range Default Description
inCharacters const Array<Region>& Character regions
inOcrModel const OcrModel& OCR model specific to a particular font
inMinScore const float 0.0 - 1.0 Minimal score of reading a character
outText String& Read text
outCharacters Array<Conditional<String>>& Array of characters. NIL indicates invalid read when inMinScore is set,
outScores Array<float>& Reading scores for each character
outIsTextValid bool& Returns False if any ad score smaller than inMinScore

Description

This operation reads a text from the array of regions. Each region corresponds to a single letter at the filter output outText. Empty regions are omitted.

This filter uses a trained OcrModel which can be created using the TrainOcr_MLP or TrainOcr_SVM filter.

Typically this filter are connected with ExtractText which prepares input regions for reading.

Hints

  • Pass an array of character regions to the inCharacters input. Usually it will be the output of the ExtractText filter.

Examples

Result of reading text using the ReadText and ExtractText.

Remarks

To read more about how to use OCR technique, refer to Machine Vision Guide: Optical Character Recognition

Errors

List of possible exceptions:

Error type Description
DomainError Uninitialized OCR model in ReadText. OCR model must be trained before use.

See Also

  • ExtractText – Ready-to-use tool for extracting and splitting character to single characters.
  • RecognizeCharacters – Classifies input regions into characters. Based on the Multi-Layer Perceptron model.
  • TrainOcr_MLP – Trains an OCR multilayer perceptron classifier.
  • TrainOcr_SVM – Trains an OCR support vector machines classifier.