You are here: Start » AVL.NET » AVL.TrainOcr_SVM_Deprecated(AvlNet.OcrSvmModel, AvlNet.CharacterSample[], AvlNet.Size?, AvlNet.OcrSvmModel, float, AvlNet.Image[])

AVL.TrainOcr_SVM_Deprecated(AvlNet.OcrSvmModel, AvlNet.CharacterSample[], AvlNet.Size?, AvlNet.OcrSvmModel, float, AvlNet.Image[])

Trains an OCR support vector machines classifier.

Namespace:AvlNet
Assembly:AVL.NET.dll

Syntax


public static void TrainOcr_SVM_Deprecated(
	AvlNet.OcrSvmModel inOcrModel,
	AvlNet.CharacterSample[] inCharacterSamples,
	AvlNet.Size? inCharacterSize,
	out AvlNet.OcrSvmModel outOcrModel,
	out float diagTrainingAccuracy,
	out AvlNet.Image[] diagNormalizedCharacters
)

Parameters

inOcrModel
Type: AvlNet.OcrSvmModel
Initialized OcrSvmModel to train
inCharacterSamples
Type: AvlNet.CharacterSample
Training font created from sample regions
inCharacterSize
Type: System.Nullable<AvlNet.Size>
Size of fixed width font, or null.
outOcrModel
Type: AvlNet.OcrSvmModel
Trained OcrSvmModel used to recognize characters
diagTrainingAccuracy
Type: System.Single
The overall training score
diagNormalizedCharacters
Type: AvlNet.Image
Images of normalized characters used to train classifier

Description

The operation trains a SVM classifier using character samples provided in the inCharacterSamples parameter.

Character training requires initialized OcrSvmModel provided in the inOcrModel. Model should be initialized by the InitOcr_SVM_Deprecated filter.

Classifier training requires at least single character to learn provided in the inCharacterSamples input. To obtain more information about creating character samples please refer to the documentation of the MakeCharacterSamples.

At the beginning it should be determined which kind of font typeface will be recognized.

There are two types of font typefaces:

  • Monospaced - the font has defined constant width and height which is the same for all characters. Space between two characters is always the same.
  • Proportional - size of each character may be different. Character height is limited only to line height. The distance between characters may depend on which characters are in the neighborhood.

The example below shows basic differences between monospaced and proportional fonts:

ABCabc123
Monospaced typeface - all characters have the same width.
ABCabc123
Proportional typeface - for example the character 'A' is much wider the character '1'.

The trained SVM classifier is stored in outOcrModel output.

Remarks

  • Using monospaced typeface option for fonts that are proportional can make a thin character too small to recognize.
  • It is good practice to make single pixel border around all characters.

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

Errors

Error type Description
DomainError Invalid OcrSvmModel in TrainOcr_SVM.
DomainError Invalid character sample in TrainOcr_SVM.

See also