Download here (22K) - Note: you will need MFC42.DLL to run this.
My first try at OCR! I limited it to the numbers 1-9, thus the name 'ONR' (Optical Numerical Recognizer). It requires two data files, learn.dat for the numbers to learn and test.dat for testing. Both files get read on startup, and stored in arrays so you can browse them graphically without doing and training or testing.
To look at the data it will learn and test, use the spin buttons under the "Training" and "Classify" buttons to browse through the testing buttons. Now, to train the perceptrons to recognize the data, merely click on "Train" and the learning process will start. With the data set I provide with the program, the iterations should not really get much higher than 20. As a safe-guard, the program will time-out after 500 iterations, so feel free to change the data files.
When learning has finished, the "Classify" button will enable. To then test what has been learnt, use the spin buttons under the "Classify" button to select a data entry that you would like to test. Press "Classify", and the program will write what it thinks the number is underneath. Note: I supplied a test set that produces very good results - with one exception. Try testing the '3' a few times, and you will find the perceptron will occasionally think it's an eight.
The program is VERY easy to expand if you want too (even without understand the code). All you will need to do is change the NN_NUMBERS define clause (in OCRDlg.h) and change the data tests. You might also want to edit the "GetText" function to return the necessary results.
For example, if you want to add the letter "A" to the data set, add:
0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1To learn.dat, and a 'noisy' version to the test set. Then, change OCRDlg.h to read "#define NN_NUMBERS 10", and add another switch to the GetText function:
case 9: str = "Letter 'A'"; break;Then recompile, and it should work! Have fun...