Unit 2 - Digital Information


digital information

Unit 2 Overview - SKIP UNIT???

Lesson 1: Bytes and File Sizes

Just as a scientist would need to understand units of measurement (length, mass, time, current) before conducting an experiment, you also need to understand units of measurement to advance as a programmer. We want to have a good understanding of terminology and general relationship between file types and sizes. Computers today are growing in power and speed, which raises opportunities and challenges in dealing with larger files. 

We will review the following information taken from our curriculum:

Terminology - Byte
Recall that a single character of ASCII text requires 8 bits. The technical term for 8 bits of data is a Byte.

A byte is the standard fundamental unit (or “chunk size”) underlying most computing systems today. You may have heard “megabyte”, “kilobyte”, “gigabyte”, etc. which are all different amounts of a bytes. We’re going to learn more about them today.

How many bytes does it take to store the word 'hello'? Take a guess. We'll try with Notepad and Word.

The Assignment

Team up with a partner and complete the following activity sheet. Send it to me on Schoology.




Lesson 2: Text Compression - UPDATE 

Vocabulary
  • Heuristic - a problem solving approach (algorithm) to find a satisfactory solution where finding an optimal or exact solution is impractical or impossible.
  • Lossless Compression - a data compression algorithm that allows the original data to be perfectly reconstructed from the compressed data.

At some point we reach a physical limit of how fast we can send bits and if we want to send a large amount of information faster, we have to find a way to represent the same information with fewer bits - we must compress the data.

  • “When you send text messages to a friend, do you spell every word correctly?”
    • Do you use abbreviations for common words? List as many as you can.
  • “Why do you use these abbreviations? What is the benefit?”


How much was it compressed?


  • Divide students into groups of 2
  • Assign each pair one of the poems provided and challenge them, as a pair to compress their poem as much as possible.
  • Do one together as a class and see who can compress the highest

  • “What makes doing this compression hard?”

  • “Do we think that these compression amounts that we’ve found are the the best? Is there a way to know what the best compression is?

    • We probably don’t know what’s best.
    • There are so many possibilities it’s hard to know. It turns out the only way to guarantee perfect compression is brute force. This means trying every possible set of substitutions. Even for small texts this will take far too long. The “best” is really just the best we’ve found so far.
  • “But is there a process a person can follow to find the best (or a pretty good) compression for a piece of text?





Lesson 3: Encoding B&W Images

pixel image
Vocabulary

  • image - A type of data used for graphics or pictures.
  • metadata - is data that describes other data. For example, a digital image my include metadata that describe the size of the image, number of colors, or resolution.
  • pixel - short for "picture element" it is the fundamental unit of a digital image, typically a tiny square or dot which contains a single point of color of a larger image.

The main purpose of this lesson is to use some creativity while getting some hands-on experience manipulating binary data that represents something other than plain numbers or text.

Digital images can be stored in many formats, but one of the most common formats is “raster”. Raster images store the image as an array of individual pixels, each of which has a particular color. Higher-quality images can be obtained by decreasing the size of the pixels (resolution). While full color will be addressed in the next lesson, an important idea here is that images on computer screens are created with light by illuminating pixels on the screen. This is why it is typical in a black and white image for the value 1 to represent white - it means turn the light on - and 0 represents black - light off. If you were drawing on paper you might do the inverse.

Today we’re going to consider how you might use bits to encode a photographic image, or if you like: how could I encode vision?

Activity Guide - Invent a B&W Encoding Scheme

What was your method for encoding the image into binary?

How have you encoded white and black portions of your image?
Are your encodings flexible enough to accommodate images of any size? * How do they accomplish this?
Is your encoding intuitive and easy to use?
  • Vocabulary: each little dot that makes up a picture like this is called a pixel. 
  • What we’ve discovered is that the data for our image file must contain more than just a 0 or 1 for every pixel. It must contain other data that describes the pixel data.
  • This is called metatdata. In this case the metadata encodes the width and height of the image.
Intro to Pixelation Encoding B & W - This video will show us how to use the pixelation widget

The Assignment

Team up with a partner and complete the following activity sheet. Send it to me on Schoology.




Lesson 4: Encoding Color Images - Update

  • In the previous lesson we came up with a simple encoding scheme for B&W images. What if we wanted to have color?
  • Devise an encoding scheme for color in an image file. How would you represent color for each pixel?
The way color is represented in a computer is different from the ways we represented text or numbers. With text, we just made a list of characters and assigned a number to each one. As you are about to see, with color, we actually use binary to encode the physical phenomenon of LIGHT. You saw this a little bit in the previous lesson, but today we will see how to make colors by mixing different amounts of colored light.


Important ideas from this video:

  • Image sharing services are a universal and powerful way of communicating all over the world.
  • Digital images are just data (lots of data) composed of layers of abstraction: pixels, RGB, binary.
  • The RGB color scheme is composed of red, green, and blue components that have a range of intensities from 0 to 255.
  • Screen resolution is the number of pixels and how they are arranged vertically and horizontally, and density is the number of pixels per a given area.
  • Digital photo filters are not magic! Math is applied to RGB values to create new ones.


The Assignment

Complete the following activity sheet. Send it to me on Schoology.

- 24 bits will match up with hex codes online