[AS3] Character Recognition

This is mainly the result of a research class that I was in over the summer. It was primarily an attempt to see if a new method of recognition could be successful, so traditional methods using neural networks, fuzzy logic, and bitmap detail extraction aren’t used. There are two different test files to choose from. One of them is preloaded with handwriting samples from yours truly, so anyone with handwriting similar to mine can test that one out. The second doesn’t have any letters defined, so it has to be trained before it can recognize anything.
**
Trained Recognizer**
Untrained Recognizer (Trainable)

**Requires: **Flash Player 9. A Wacom (or similar) tablet makes this much more accurate.

To train:

-Click on the TextField in the upper left corner that says ‘Recognition Mode’, the text should change to ‘Definition Mode’. (It acts like a button)

-Decide which letter (or symbol) you want to define, and type this into the TextField at the top of the Stage. The TextField has an ‘a’ in it by default.

-Using (ideally) a tablet pen or other mousing device, draw the letter that you want to define.

-Press the ‘Define Character’ button (or the ‘d’ key) to tell Flash Player that this is the character. If you make a mistake, simply draw the character again before pressing the button. As long as the old and new characters aren’t drawn on top of eachother, everything should be fine.

-To increase the chances of correct recognition, repeat the previous two steps numerous times.

-To define another character, change the text in the ‘Character to define’ field.

-Return to recognition mode by pressing the same button that you used to get into definition mode (upper left corner).

**To recognize: **

-Make sure that you have either launched the version of the recognizer with preloaded definitions, or that you have gone to definition mode and defined characters yourself.

-Draw a character.

-Press the ‘Recognize Character’ button (or the space bar). The box in the upper left corner should now display the character that you drew. It may also display an incorrect character or no character at all if it had no idea what you were trying to draw.

**Source: **

What kind of post would this be if I didn’t include the source?

The source can be viewed here:

Source (HTML, formatted and colorized) (Includes link to .zip and Flex SDK)
Source (.zip, AS files only)

ASDocs:

The main application is almost completely private, as it is not meant to be subclassed or contained. ASDoc method signatures are included in the .as source files but are not accessible through the published ASDocs. The net.reclipse.handwriting package, however, is essentially fully documented and easily viewable through the following link:

Recognizer ASDocs

Modification and Reuse:

If you would like to use this or a derivative of this yourself, please contact me (A PM would be fine) about it first. This applies especially if you are going to using this for academic/school/research purposes. I still intend to improve and modify this and some of the novelty of the recognition method would be lost if others started using this without permission and without properly referencing the original author. I don’t mean to scare anyone away with this section. Honestly, if you steal this and don’t tell me (or even if you do tell me) I won’t be upset. :slight_smile:

I coded this mainly in Flex Builder 2.0 Beta 3, though towards the end minor modifications were made using the final, shipping version of Flex Builder 2. The .as files should be compilable with the Flex 2 SDK, which is linked to in the first source link.

I hope this is interesting to some of you! Personally I have found this to be about 62% accurate with my own handwriting, though I designed the system to (hopefully) be able to recognize most characters.

If you want to know more about how it works I would be happy to send you an in-depth explanation that delves more into research related areas rather than ActionScript.

Edit: Sorry for the long post, I tried to be somewhat thorough with the instructions because the application is a bit confusing to work with and a confusing application is no fun to use. :stuck_out_tongue: