C# Class HistogramOCRTrainer.HistogramOCR

example usage: https://github.com/andreigec/Word-Find-Solver
Show file Open project: andreigec/Word-Find-Solver Class Usage Examples

Public Properties

Property Type Description
HistogramHeight int
HistogramWidth int
Letters List
WhiteBitmap System.Drawing.Bitmap

Public Methods

Method Description
DeSerialise ( string filename ) : HistogramOCR

Des the serialise.

HistogramOCR ( int HWidth = 20, int HHeight = 20 ) : System

initialise with a file, or blank

Normalise ( Bitmap b1 ) : Bitmap

trim white and resize to created dimensions

PerformOCR ( Bitmap b, int spaceForWhiteSpace = -1 ) : string[]

Performs the ocr.

PerformOCR ( string filename, int spaceForWhiteSpace = -1 ) : string[]

Performs the ocr.

PerformOCRCharacterPerfect ( Bitmap b ) : char?

Performs the ocr character perfect.

Serialise ( string filename ) : void

Serialises the specified filename.

SplitUp ( Bitmap b, int whiteToSpace = -1 ) : System.Drawing.Bitmap[][]

Splits up.

Train ( Bitmap b, char letterChar ) : bool

take an image of a letter and a character of what it is, and train the ocr

Train ( string filename, string letters, int spaceForWhiteSpace = -1 ) : bool

Trains the specified filename.

Private Methods

Method Description
GetOffScore ( Bitmap b, HistogramLetter l ) : int

get score. score of 0 is perfect

PerformOCRCharacter ( Bitmap b, bool perfectOnly = false ) : char

Performs the ocr character.

Split ( Bitmap b, bool byRow, int &whiteToSpace ) : IEnumerable

Splits the specified b.

Method Details

DeSerialise() public static method

Des the serialise.
public static DeSerialise ( string filename ) : HistogramOCR
filename string The filename.
return HistogramOCR

HistogramOCR() public method

initialise with a file, or blank
public HistogramOCR ( int HWidth = 20, int HHeight = 20 ) : System
HWidth int Width of the h.
HHeight int Height of the h.
return System

Normalise() public method

trim white and resize to created dimensions
public Normalise ( Bitmap b1 ) : Bitmap
b1 System.Drawing.Bitmap The b1.
return System.Drawing.Bitmap

PerformOCR() public method

Performs the ocr.
public PerformOCR ( Bitmap b, int spaceForWhiteSpace = -1 ) : string[]
b System.Drawing.Bitmap The b.
spaceForWhiteSpace int The space for white space.
return string[]

PerformOCR() public method

Performs the ocr.
public PerformOCR ( string filename, int spaceForWhiteSpace = -1 ) : string[]
filename string The filename.
spaceForWhiteSpace int The space for white space.
return string[]

PerformOCRCharacterPerfect() public method

Performs the ocr character perfect.
public PerformOCRCharacterPerfect ( Bitmap b ) : char?
b System.Drawing.Bitmap The b.
return char?

Serialise() public method

Serialises the specified filename.
public Serialise ( string filename ) : void
filename string The filename.
return void

SplitUp() public method

Splits up.
public SplitUp ( Bitmap b, int whiteToSpace = -1 ) : System.Drawing.Bitmap[][]
b System.Drawing.Bitmap The b.
whiteToSpace int default = will calculate
return System.Drawing.Bitmap[][]

Train() public method

take an image of a letter and a character of what it is, and train the ocr
public Train ( Bitmap b, char letterChar ) : bool
b System.Drawing.Bitmap The b.
letterChar char The letter character.
return bool

Train() public method

Trains the specified filename.
public Train ( string filename, string letters, int spaceForWhiteSpace = -1 ) : bool
filename string The filename.
letters string The letters.
spaceForWhiteSpace int The space for white space.
return bool

Property Details

HistogramHeight public property

public int HistogramHeight
return int

HistogramWidth public property

public int HistogramWidth
return int

Letters public property

public List Letters
return List

WhiteBitmap public static property

The white bitmap
public static Bitmap,System.Drawing WhiteBitmap
return System.Drawing.Bitmap