Development of an OCR System Third Quarter Nathan Harmata Period 5.

17
Development of an OCR System Third Quarter Nathan Harmata Period 5

Transcript of Development of an OCR System Third Quarter Nathan Harmata Period 5.

Page 1: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Development of an OCR SystemThird Quarter

Nathan HarmataPeriod 5

Page 2: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Recap of Goals for 3rd Quarter

More heuristics for Character Recognition

Make results more “spread out”Make results more “spread out”

Minor goal: “generic character models”

Page 3: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Diagram of OCR System

Input Image

Blocks of Text

LinesLines Lines

Words WordsWords

ImageProcessing

CharacterRecognition

LetterLetter Letter

Transformations Transformations

Comparison to GCDD and recognition

CharacterModel

Page 4: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Image Processing

Uses whitespace between lines and words

Page 5: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Character Recognition

Developed new heuristic: GapVector

Developed GCD (Generic Character Definitions)

Character Models and Attributes

Page 6: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Attribute

My two comparison heuristics, SectorVector and GapVector, are extensions of the Attribute class

Attribute

Description ComparisonScalar

Method of comparison

Method of output to database

Uses specific comparisonused by the overriding class

Uses outputs of overriding class

Data

Page 7: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Character Model

Came up with idea during 2nd Quarter

Way of organizing data and making code cleaner

Character Model

Attribute Attribute HashMap of Attributes

Method of comparison

Method of output to database

Uses vector difference of Attribute Vectors

Uses outputs of Attributes

Method of hashing Uses hashcode of output

Page 8: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Sector Vector - SectorParsing

Deals with the major flaw with SlopeField

Parses the image into portions that pass the vertical line test. Each portion is then transformed into a SlopeField.

Page 9: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Sector Vector -SlopeField

Page 10: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Gap Vector -Theory

Separates the different letters into groups

Examples: n, m u, v Q, o, 0

Page 11: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Gap Vector -Gap Parsing

First find the four corners of the letter

Defined as the intersection of the two paths

Page 12: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Gap Vector -Gap Parsing

First idea: relative gap coverages-coverage of pixels on the line that would exists if there were a gap

Straight-line pathAreas of pixel coverage

Page 13: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Gap Vector -Gap Parsing

Second idea: locations of pixels relative to the gap

This just ends up being a comparison of the area of the pixels in front of the straight line to the areas of the pixels behind the straight line

-More pixels in front of gap -> no gap

Page 14: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Gap Vector -Gap Parsing

Page 15: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Putting everything together

Example Character Model output:

c SectorVector -2 3 GapVector R

Do this for every letter of the alphabet for a lot of different fonts and average the results

To recognize an individual image of a letter, find the best matches in the cache based using the “compareTo” method of the CharacterModel class

Page 16: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Character Model Cache

a SectorVector -5 5 GapVector b GapVector SectorVector 4 3 c SectorVector -2 3 GapVector R d SectorVector -1 3 GapVector e SectorVector -2 3 GapVector f SectorVector 0 3 GapVector R g SectorVector -1 5 GapVector h SectorVector 0 1 GapVector i SectorVector 0 2 GapVector L j SectorVector 0 4 GapVector k SectorVector -2 3 GapVector R l SectorVector 0 1 GapVector m SectorVector -3 1 GapVector T n SectorVector -1 1 GapVector o SectorVector -3 3 GapVector p GapVector SectorVector 4 3 q SectorVector -1 3 GapVector r SectorVector 0 1 GapVector R s SectorVector -2 6 GapVector t SectorVector 0 3 GapVector u SectorVector 0 1 GapVector T v GapVector T SectorVector -2 1 w SectorVector -5 1 GapVector T x SectorVector -4 3 GapVector T L y SectorVector -2 3 GapVector T L z SectorVector 1 4 GapVector L

** Use Java Reflections for generic Attribute handling

Page 17: Development of an OCR System Third Quarter Nathan Harmata Period 5.

Goals for 4th Quarter

Get everything working together-almost done, haven’t tested it yet

Think of another heuristic if the results are good enough

Make GUI for OCR system

Noise removal