EnggRoom

Full Version: Text Recognizer
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Problem Domain
• In the proposed system, we shall be dealing with the problem of machine reading typewritten / handwritten characters.
• This corresponds to the ability of human beings to recognize such characters, which they are able to do little or no difficulty.
• The aim is to produce a system that classifies a given input as belonging to a certain class rather than to identify them uniquely, as every input pattern.
• The system performs character recognition by quantification of the character into a mathematical vector entity using the geometrical properties of the character image.
• The scope of the proposed system is limited to the recognition of a single character. 



Solution Domain
 Step 1: Load Image
• Take either a png, gif or jpeg image file and load it by using a data structure ‘Picture’.
• This creates an 2D array of pixels, and allows the program to get each pixel’s color individually.

Step 2: Locate Characters
• Look at each pixel. If the pixel is black, mark it with a unique id number and recursively search for pixels touching this pixel, till all connected pixels are found.
Original Scaled / Converted to black and white

Step 3: Identify Characters
• Build the set of trainer images.



e.g. ,

• Compare each character in our test images to all the known letters in the trainer set.
• The test character was scaled to the same size as the trainer images (12 by 14 pixels), and converted to black and while.
• The test character was compared to each image in the trainer set to determine a score for each letter: number of matched pixels/number of total pixels
• Problem Characters
o Since only touching black pixels make one “character” the dot on an “i” is ignored. This is fixed by looking at the pixels right above a letter to see if there is a “dot”.
o Similar issues for the i, j, ? and !
o Since all the characters are scaled to the same size the uppercase I and lower case l can look identical in some fonts.
o This is fixed with the grammar check latter.
• Efficiency:
o We have 8 trainers with 66 characters in each trainer (upper case, lower case, numbers and ! ?)
o That’s 528 images to compare per character to test.
o Each image contains 168 pixels, which makes for a total of 88704 pixels to compare.
o To speed the processing time, the program keeps track of what trainer received the highest score. If the same trainer is used repeatedly, it stops checking all 8 trainers and just checks the “good” trainer.
Step 4: Create Words
• Identify which characters are close to each other to create groups of characters: words
o For each letter, search a set number of pixels to the left or right, and check if it finds another character. This number must be set carefully, and varies between different fonts. Computer fonts are very regular in spacing, human printing is a bit more messy.

Step 5: Order Words
• Sort the words into separate lines, then order the words in that line.
o Determine the height where each line starts.
o Order lines by starting at the top.
o Order word, within lines, from left to right.

Step 6: Check Words
• Try to fix bad matches that don’t make sense grammatically.
o Since all letters are scaled to the same dimensions, zeros and the letter ‘o’ in stop can look almost identical.
o Many other letters, such as (s S) (w W) (x X) (z Z) (v V) look the same in bother upper and lower case.

Step 7: Spell Check
• Run all words through a dictionary.
• Replace with the higher scoring letter.
Step 8: Add Punctuation and Check Grammar
• Add punctuation such as commas, periods and apostrophes.



System Domain
Hardware
• Minimum 32 MB RAM (approx.)
Tools
• Software IDEs
o NetBeans 7.2, Eclipse Juno
• Database
o Oracle 10g, SQLite
• Platform
o JavaSE & Android