Match characters based on a text pattern "image"
What would be a good way to approach matching a String pattern of X's to any uppercase letter in the alphabet, A-Z, given a master pattern. I'm looking for either a code example (in Java) or just a general algorithm idea.
For example, I'm given the "master pattern" for 'T' of:
X X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
...and all of the following patterns must be determined to be T's based on the master pattern.
X X X X X X X X X
X X X
X
X
X
X
X
X
X
X
X
or
X X X X X X X X X
开发者_如何学Python X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
or
X X X X X X X X X
X X X X X X X X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
X X
The algorithm would have to be generic enough to work for all letters; T is just an example.
Look into http://jocr.sourceforge.net/, which is a free OCR library. It's a C library, so using it directly is probably not an option for you. If nothing else, you can at least dig through the source.
You may also want to take a peak at http://userscripts.org/scripts/review/38736, which is a pure JavaScript implementation of a neural-net based OCR algorithm.
As has been mentioned in the comments already this is by no means a trivial problem to solve well, but you might be able to get by on a naive neural net that suits your data.
精彩评论