Contour-Based Digit Recognition Chris Douglas Motivation ● ● Normalized cross-correlation is fine for a single font with a single size Contours contain a lot of the information used by humans to distinguish between characters ● Using only contours shrinks the problem size Shape Classification Methods ● Descriptors ● Classification ● Fourier Descriptors ● K-means ● Zernike Moments ● K-nearest neighbors ● Legendre Moments ● Decision trees ● Statistical Moments ● Mahalanobis distance ● ● ● Hu's Invariant Moments Splines Other descriptors such as area, eccentricity, height, ● ● Support Vector Machines (SVM) Neural networks Process ● ● ● ● ● Assume training images are pre-classified correctly, binary, and mostly free of noise/occlusion Take the contours of the image Find the contour lists of the contours ('bwtraceboundary') Mean center these lists and scale to a standard size while preserving the overall shape of the character Rotate by angle from 'regionprops' 'orientation' property Process (continued) ● Resize so each contour is the same amount of points in length ● Isn't necessary for some descriptors ● Can be done with interpolation in the spatial domain ● Decided to carefully use the frequency domain and pad an array of DFT coefficients with 0s to the correct size – Special considerations need to be made Data ● Fonts and handwritten numbers with varying degree of carelessness (dataset 1) ● ● ● ● 1280 training images Test data are handwritten samples by 2 willing participants and paint-created samples MNIST data base (dataset 2) ● 60,000 training images ● 10,000 test images ● The images seen thus far Carefully handwritten numbers by one person (dataset 3) ● 1251 Training images ● 210 Test images Dataset 1 Results ● ● Single contour ● (K=5) All but a 2 & a 3 were classified correctly ● (K=4) All images were classified correctly Multiple contour ● (K=5) – – ● Fourier misclassified a 3 as a 7 Absolute Difference of contour points misclassified the same 3 as a 7, a 2 as a 1, and a 0 as a 1. (K=1) – – Fourier misclassified a 7 as a 4, a 3 as a 7 Absolute difference misclassified the same 7 as a 4, and a 0 as a 4 Dataset 2 Results (single contour) Dataset 2 Results (multiple contour) Dataset 3 Results ● Single contour ● ● (K=5) A 5 was misclassified as a 9 Multiple contour ● ● (K=5) Three 7s were misclassified as a 2,3,and a 5, a 0 was misclassified as an 8 (K=1) A 7 was misclassified as a 2