Lesson How Do You Store All This Data?

Quick Look

Grade Level: 12 (11-12)

Time Required: 45 minutes

Lesson Dependency:

Subject Areas: Computer Science

NGSS Performance Expectations:

NGSS Three Dimensional Triangle
HS-ETS1-4

Photo shows a keypad with a person's finger about to press on a button.
How does data get stored?
copyright
Copyright © 2004 Microsoft Corporation, One Microsoft Way, Redmond, WA 98052-6399 USA. All rights reserved.

Summary

During this lesson, students start to see the data structure they will use to store their images, towards finding a solution to this unit's Grand Challenge. Students are introduced to two-dimensional arrays and vector classes. Then they are guided to see that a vector class is the most efficient way of storing the data for their images. Grand Challenge: To write a program to simulate peripheral vision by merging two images.
This engineering curriculum aligns to Next Generation Science Standards (NGSS).

Engineering Connection

Data of all kinds is often stored in arrays to make it easier to work with on a large scale. Arrays are often used in computer programming as a way to store and manipulate data. An example of this data could be the pixels in a two-dimensional image, which is the focus of this lesson. Computer science engineers also know that arrays also make it easier to retrieve stored data.

Learning Objectives

After this lesson, students should be able to:

  • Initialize a two-dimensional array.
  • Initialize a new instance of a vector class.
  • Store RGB values in a vector.
  • Read data from vector and write to a new image.
  • Apply new knowledge to the unit's Grand Challenge question.

Tennessee State Standards for C++ Programming Applications (2005)

  • Standard 5.0 - The student will write and document an executable program in C++ Programming Language.

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.

NGSS Performance Expectation

HS-ETS1-4. Use a computer simulation to model the impact of proposed solutions to a complex real-world problem with numerous criteria and constraints on interactions within and between systems relevant to the problem. (Grades 9 - 12)

Do you agree with this alignment?

Click to view other curriculum aligned to this Performance Expectation
This lesson focuses on the following Three Dimensional Learning aspects of NGSS:
Science & Engineering Practices Disciplinary Core Ideas Crosscutting Concepts
Use mathematical models and/or computer simulations to predict the effects of a design solution on systems and/or the interactions between systems.

Alignment agreement:

Both physical models and computers can be used in various ways to aid in the engineering design process. Computers are useful for a variety of purposes, such as running simulations to test different ways of solving a problem or to see which one is most efficient or economical; and in making a persuasive presentation to a client about how a given design will meet his or her needs.

Alignment agreement:

Models (e.g., physical, mathematical, computer models) can be used to simulate systems and interactions—including energy, matter, and information flows—within and between systems at different scales.

Alignment agreement:

  • Use computers and calculators to access, retrieve, organize, process, maintain, interpret, and evaluate data and information in order to communicate. (Grades 9 - 12) More Details

    View aligned curriculum

    Do you agree with this alignment?

  • Use various approaches to communicate processes and procedures for using, maintaining, and assessing technological products and systems. (Grades 9 - 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/van_robotic_vision_less3] to print or download.

Introduction/Motivation

In this lesson, you will learn how a computer image is composed. You will need to understand that a digital image is nothing more than a grid of colors. The grid can easily be stored and manipulated by using nested loops. Following the lesson, students can complete the associated activity Putting It All Together: Programming Robotics Peripheral Vision.

Lesson Background and Concepts for Teachers

Lecture Information

  • Two-dimensional arrays are used to store data. Each data point is identified by its horizontal and vertical position in the array. Think of the data as being stored in a grid.
  • This address system is similar to the way points on a graph are addressed on an x-y plane, that is, the coordinate points (1, 2) would be one unit from the origin along the x-axis, and 2 units from the origin along the y-axis.

A table with column numbers x row numbers.
Figure 1. Example 4 x 3 array.

  • Similarly, in an array, two subscripts are given, the first standing for the row number, the second representing the column number. By convention, rows and columns are both numbered from 0. Figure 1 shows an example 4 x 3 array and the subscripts representing each point within the array. (Note, the [a][b] notation is unique to C, most other languages refer to the same address as [a,b]).
  • The following website explains the use of arrays in computer programming in more detail and gives example coding: https://www.tutorialspoint.com/computer_programming/computer_programming_arrays.htm

Summary

  • Two ways to pass a pointer to a two dimensional array: subscript notation and typecasting.
  • Subscript notation requires that data type of the second subscript needs to match based on the function.
  • Typecasting in the function call uses a pointer with offsets inside the function so that information in arrays of differing dimensions can be processed using the same function.
  • A vector template class allows for a dynamic array, which can be expanded to account for input of different amounts of information.

Associated Activities

  • Putting It All Together: Programming Robotics Peripheral Vision - In the concluding activity of the unit, students write the code to solve the Grand Challenge. The solution takes two images captured by robots and combines them to create an image that can be focused at different distances, mirroring human vision.

Vocabulary/Definitions

array: A block of related data elements, each of which is identified by one or more subscripts.

subscript: Coordinate giving location in a single dimension in an array. Two subscripts together create an address of an element in a two-dimensional array.

Assessment

As homework, have students complete the Data Storage Assignment Handout, which asks them to read data from a 16 x 16 image grid and store the data in an array. Then they are challenged to see if they can flip the image around by using nested loops. Assess their learning by their completion of the 16 x16 grid manipulation code and answers to the handout questions. Then proceed to conduct the associated activity, Putting It All Together: Programming Robotics Peripheral Vision.

Subscribe

Get the inside scoop on all things TeachEngineering such as new site features, curriculum updates, video releases, and more by signing up for our newsletter!
PS: We do not share personal information or emails with anyone.

More Curriculum Like This

High School Lesson
May the Magnetic Force Be with You

After a demonstration of the deflection of an electron beam, students review their knowledge of the cross-product and the right-hand rule with example problems. Students apply these concepts to understand the magnetic force on a current carrying wire. Through the associated activity, students furthe...

References

"Array." Dictonary.com. Unabridged. Random House, Inc. Accessed 22 Jun. 2010. http://dictionary.reference.com/browse/Array

Copyright

© 2013 by Regents of the University of Colorado; original © 2010 Vanderbilt University

Contributors

Mark Gonyea; Anna Goncharova; Rachelle Klinger

Supporting Program

VU Bioengineering RET Program, School of Engineering, Vanderbilt University

Acknowledgements

The contents of this digital library curriculum were developed under National Science Foundation RET grant nos. 0338092 and 0742871. However, these contents do not necessarily represent the policies of the NSF, and you should not assume endorsement by the federal government.

Last modified: March 27, 2024

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