CS 7321 Winter 1998
PS#1 Solutions by Rob
Orr
Character Recognition Problem
Index
How I solved it
For each vowel and each image, I performed the following steps:
- Manually cropped out a representative vowel:
- imcrop()
- prepared a crop mask for the script to use after it had thinned the
vowel
- imwrite()
- Found where that vowel occurred in the original image:
- Thin the vowel template: bwmorph('thin')
- Crop the thinned vowel template using the prepared crop mask to give
just the vowel frame: imcrop()
- Threshold the image: im2bw()
- Thicken the image: bwmorph('thicken')
- Erode the image with the thinned vowel template: erode()
- Cleaned away single pixel occurances (noise): bwmorph('clean')
- Dilated the resulting image with the original vowel template: dilate()
- Composed the vowel occurance image with the original image to show
vowels in red:
- Convert vowel occurance image to double, multiply by 2, convert back
to uint8
- Compose final image: max(original, occurance image)
- Display image with special colormap
to TOP
Assumptions and Weaknesses
I made the following assumptions
- The vowel that I chose as a template would be representative of every
occurance
- The vowels in the images would be regular across the images
- Vowels occurances would generate larger than single pixel erosions
- Techniques that worked well for the single vowel 'e' would work well
for all vowels
I think the major weakness of my solutions are:
- The vowel templates are not representative!
- The vowels are not regular across the images!
- The techniques that work for 'e' don't work across all vowels!
- The thickening of the images is too aggressive: it produces areas too
large for the erosion and we get matches of vowels where they don't really
occur
Improvements and Possible Future Work
I think that this can be improved by doing the following
- Averaging vowels to create better templates
- Find a way to thicken the images without being too aggressive
- I didn't do rotation (but the vowels were matched successfully in many
cases even so--see the 'e' case below). I had problems getting the rotation
and matrix operations to work correctly. This is an obvious improvement.
- Show different vowels in different colors.
- The all-vowel case is terrible (see below). I seems to be mostly due
to overaggressive matching. While the 'e' case worked out well in most
cases, the all-vowel case needs to be improved greatly.
Results
Figure 1: This is the first sample with just the 'e' matched. This came
out fairly well.
Figure 2: This is the second sample with just the 'e' matched. Again,
it came out fairly well but you can see a little overaggressiveness.
Figure 3: This is the third sample with just the 'e' matched. No rotation
was done but note that it still got 7 of 11 e's (and some false positives).
Figure 4: This is the first sample with all the vowels matched. This
is terrible.
Figure 5: This is the second sample with all vowels matched. Terrible.
Figure 6: This is the third sample with all vowels matched. Again, terrible.
Source Code
- script.m
: this is the script showing how the problem solution was arrived at