Lesson: Java Programming of OCR

Quick Look

Grade Level: 11 (9-12)

Time Required: 1 hours 30 minutes

(can be split into two 45-minute sessions)

Lesson Dependency: None

Subject Areas: Computer Science, Geometry

Three images of the license plate number 4YCH428. The first image shows black letters on a gray background. Next, the background is white. Then, each letter/number has a red box around it.
Automatic number plate recognition uses OCR to read vehicle plates. This license plate image has been de-skewed, sized, adjusted for brightness and contrast, and its individual characters segmented so it is ready for OCR.
Copyright © 2006 Achim Raschka, Wikimedia Commons http://commons.wikimedia.org/wiki/File:California_license_plate_ANPR.png


Student groups use the Java programming language to implement the algorithms for optical character recognition (OCR) that they developed in the associated lesson. They use different Java classes (provided) to test and refine their algorithms. The ultimate goal is to produce computer code that recognizes a digit on a scoreboard. Through this activity, students experience a very small part of what software engineers go through to create robust OCR methods. This software design lesson/activity set is designed to be part of a Java programming class.

Engineering Connection

This hands-on activity provides students with experience in using the engineering design process (more specifically, the software design process; a specific application of the engineering design process) in a controlled environment. Design is a critical part of engineering. Engineers of all disciplines follow the steps of the design process to develop and improve solutions to real-world problems. Software engineers perform exactly the same process that students complete in the activity when they develop the software packages we use everyday. They define a problem, design solutions, implement those designs, test the implementation, and evolve the solutions.

Learning Objectives

After this activity, students should be able to:

  • Explain software testing and challenges involved in software testing.
  • Apply optical character recognition as a Java method.
  • Determine the reliability of their OCR implementations.

Educational Standards

Each TeachEngineering lesson or activity is correlated to one or more K-12 science, technology, engineering or math (STEM) educational standards.

All 100,000+ K-12 STEM standards covered in TeachEngineering are collected, maintained and packaged by the Achievement Standards Network (ASN), a project of D2L (www.achievementstandards.org).

In the ASN, standards are hierarchically structured: first by source; e.g., by state; within source by type; e.g., science or mathematics; within type by subtype, then by grade, etc.

  • The design process includes defining a problem, brainstorming, researching and generating ideas, identifying criteria and specifying constraints, exploring possibilities, selecting an approach, developing a design proposal, making a model or prototype, testing and evaluating the design using specifications, refining the design, creating or making it, and communicating processes and results. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Design problems are seldom presented in a clearly defined form. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Analyze characteristics and properties of two- and three-dimensional geometric shapes and develop mathematical arguments about geometric relationships (Grades Pre-K - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • use geometric ideas to solve problems in, and gain insights into, other disciplines and other areas of interest such as art and architecture (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Create geometric models to visualize, describe, and solve problems using similar triangles, right triangles, and trigonometry. (Grades 9 - 11) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Characteristics: Students will identify and describe geometric characteristics and create two- and three-dimensional shapes. (Grade 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

Suggest an alignment not listed above

Worksheets and Attachments

Visit [www.teachengineering.org/lessons/view/uno_doyousee_lesson01_activity1] to print or download.

More Curriculum Like This

Do You See What I See?

Students explore the concept of optical character recognition (OCR) in a problem-solving environment. They research OCR and OCR techniques and then apply those methods to the design challenge by developing algorithms capable of correctly "reading" a number on a typical high school sports scoreboard....

preview of 'Do You See What I See?' Lesson
High School Lesson
Using JUnit to Design Software Testing Programs

Students focus on the testing phase of the design process by considering how they have tested computer programs in the past and learning about a new method called JUnit to test programs in the future. JUnit is a testing method that is included with NetBeans (Java) installs or can be downloaded from ...

Pre-Req Knowledge

Students and teachers must have a strong understanding and experience with Java programming basics.


Animated gif of a seven-segmented display (shown in Figure 1) that lights up different combinations of the segments in bright green to form the 0-9 numbers and A-F letters, one at a time, continuously.
A seven-segmented LED displays digits zero through nine, and then rotates through A, b, C, d, E, F.
Copyright © 2013 INeverCry, Wikimedia Commons http://commons.wikimedia.org/wiki/File:Seven_segment_display-animated.gif

In this activity, you will obtain valuable hands-on experience with the steps of the engineering design process. All engineers follow some type of design process as they develop solutions for problems. As you play the part of a team of software engineers, your challenge is to create a Java program that can perform optical character recognition (OCR) on one digit of a scoreboard. This is a small part of OCR, but is a good place to start.

How do software engineers approach a new challenge? (Listen to student ideas; expect them to know this.) They first define the difficulties and constraints that affect the problem and then create design solutions that address the problem and those constraints. You did this in the associated lesson when you created your algorithms on paper. Now, you will see if what you designed will work. You will implement, test and refine your algorithms, which are the next steps in the engineering design process.

Engineers work collaboratively in teams to develop software, so you will not work alone. Remember that teams benefit from the different resources and ideas that each person brings. That means that teams have the potential to solve problems more easily than people working alone. As you work in your group, build on each other's ideas and expertise to improve your design solutions.


Java: An object oriented computer programming language.

optical character recognition: The mechanical or electronic conversion of handwritten, typewritten or printed text into machine-encoded text. (OCR)

ScoreMaker software: A java-based software designed by the author and provided as an attachment to this activity.

test oracle: In software testing, a set of known input data and a corresponding set of known or expected output data.


Pre-Activity Assessment

Pre-Quiz: Before starting the activity, administer the three-question Pre-Activity Quiz. The pre-quiz ask students to consider challenges in designing and testing software that does not allow for full testing. Example answers are provided on the Pre-Activity Quiz Answer Key.

Activity Embedded Assessment

Observations: As students are engaged in the activity, ask yourself the following (or similar) questions:

  • Do students grasp the idea that many software programming situations do not lend themselves to be absolutely, fully tested?
  • Are students able to identify techniques to test software when no oracle or known answers are available for every question?

Post-Activity Assessment

Presentations: After groups have polished their programs, have each team present to the class how its program functions, its algorithm logic, its testing discoveries and how well it works using the ScoreMaker software. Then, as a class, test several images using each OCR algorithm design in turn, so everyone sees the varying levels of success with each approach. Use this opportunity to assess group accomplishments in maximizing testing results to build robust and accommodating algorithms.

Post-Quiz: At activity end, administer the Post-Activity Quiz. Through three essay questions, assesses students individually on their understanding of software that is not able to be fully tested for all scenarios and resulting implications. Example answers are provided on the Post-Activity Quiz Answer Key.


Automatic Number Plate Recognition. Last updated April 14, 2014. Wikipedia, The Free Encyclopedia. Accessed April 16, 2014. http://en.wikipedia.org/wiki/Automatic_number_plate_recognition

Comparing the Engineering Design Process and the Scientific Method. Science Buddies. Accessed April 15, 2014. http://www.sciencebuddies.org/engineering-design-process/engineering-design-compare-scientific-method.shtml


© 2014 by Regents of the University of Colorado; original © 2013 Board of Regents, University of Nebraska


Derek Babb

Supporting Program

IMPART RET Program, College of Information Science & Technology, University of Nebraska-Omaha


The contents of this digital library curriculum were developed as a part of the RET in Engineering and Computer Science Site on Infusing Mobile Platform Applied Research into Teaching (IMPART) Program at the University of Nebraska-Omaha under National Science Foundation RET grant number CNS 1201136. However, these contents do not necessarily represent the policies of the National Science Foundation, and you should not assume endorsement by the federal government.

Last modified: September 26, 2018


Free K-12 standards-aligned STEM curriculum for educators everywhere.
Find more at TeachEngineering.org