Using K-Nearest Neighbor in Optical Character Recognition


  • Veronica Ong Bina Nusantara University
  • Derwin Suhartono Bina Nusantara University



optical character recognition, k-nearest neighbor, image processing, computer vision


The growth in computer vision technology has aided society with various kinds of tasks. One of these tasks is the ability of recognizing text contained in an image, or usually referred to as Optical Character Recognition (OCR). There are many kinds of algorithms that can be implemented into an OCR. The K-Nearest Neighbor is one such algorithm. This research aims to find out the process behind the OCR mechanism by using K-Nearest Neighbor algorithm; one of the most influential machine learning algorithms. It also aims to find out how precise the algorithm is in an OCR program. To do that, a simple OCR program to classify alphabets of capital letters is made to produce and compare real results. The result of this research yielded a maximum of 76.9% accuracy with 200 training samples per alphabet. A set of reasons are also given as to why the program is able to reach said level of accuracy.


Coates, A., Carpenter, B., Case, C., Satheesh, S., Suresh, B., Wang, T., Wu, D. J., & Ng, A. Y. (2011). Text Detection and Character Recognition in Scene Images with Unsupervised Feature Learning. Document Analysis and Recognition (ICDAR), 440-445. Engineers Garage. (n.d.). Introduction to Image Processing. Retrieved on July 8, 2015 from

Escrivá, D. M. (2008, November). Basic OCR in OpenCV. Accessed on June 11, 2015 from

Marr, D. (1982). Vision: A Computational Investigation into the Human Representation and Processing of Visual Information. New York: W.H. Freeman

Mithe, R., Indalkar, S., & Divekar, N. (2013). Optical Character Recognition. International Journal of Recent Technology and Engineering, 2(1), 72-75

Nixon, M. S., & Aquado, A. S. (2002). Feature Extraction and Image Processing. Great Britain: Newnes

Shah, M., & Jethava, G. B. (2013). A Literature Review on Hand Written Character Recognition. Indian Streams Journal, 3(2), 1-19.

Shapiro, L. G., & Stockman, G. C. (2001). Computer Vision. Upper Saddle River, N.J: Prentice-Hall

Szeliski, R. (2011). Computer Vision: Algorithms and Applications. London: Springer-Verlag

Thirumuruganathan, S. (2010, 7 May). A Detailed Introduction to K-Nearest Neighbor (KNN) Algorithm. Retrieved on July 21, 2015 from

Vamvakas, G., Gatos, B., Stamatopoulos, N., & Perantonis, S. J. (2008). A Complete Optical Character Recognition Methodology for Historical Documents. The Eighth IAPR Workshop on Document Analysis Sytems, 525-532.

Wikipedia. (2015). Optical Character Recognition. Retrieved on July 8, 2015, from

Willis, N. (2006, 28 September). Google’s Tesseract OCR engine is a quantum leap forward. Retrieved on July 8, 2015 from

Wu, X., Kumar, V., Quinlan, J. R., Ghosh, J., Yang, Q., & Motoda, H. (2007). Top 10 Algorithms in Data Mining. Knowledge and Information Systems, 14, 1-37.






Abstract 1638  .
PDF downloaded 550  .