Digitization

# 1. Digitization

## 1.1. Objectives

• To define digitization.
• To understand the process by which information is converted to 0s and 1s.

## 1.2. Motivation

• Computers store information in binary. Conversion of information to binary numbers requires digitization.

## 1.3. Definition

• Digitization is the process of breaking something into pieces.
• In computing, it usually means converting some form of information to 1s and 0s for storage on a digital computer.

## 1.4. Digitization Steps

1. Draw the boundary lines for the pieces
2. Decide what category each piece is in
3. Assign a bit pattern to each category

The last step amounts to creating your own encoding table for the list of all possible categories.

## 1.5. Digitizing measurements

 Suppose that I want to keep a record of how much it rains on each night. I put out a test tube with two lines drawn on it corresponding to less than 1 inch of rain, between 1 and 2 inches of rain, and more than 2 inches of rain. Instead of writing out the words, I use bit patterns 00, 01, 10, and 11 to correspond to the four possibilities.  Day Rain Amount 1 00 2 01 3 10 4 11 

In terms of the digitization steps

1. Draw the boundary lines for the pieces - Drew lines for the boundaries of different levels of rain.
2. Decide what category each piece is in - Decided to use less than 1 inch, 1-2 inches, and more than 2 inches.
3. Assign a bit pattern to each category - Decided to use a two-bit pattern.

## 1.6. Digitizing a photo I

We are going to digitize a black and white photo of a shape.

Step 1: Draw the boundary lines for the pieces - Overlay a grid; the squares represent the pieces.

Step 2: Decide what category each piece is in - If more than one-half of the square is black, label square as "B". Otherwise, label square as "W".

Step 3: Assign a bit pattern to each category - Choose a bit pattern of length 1. If category is B, use bit pattern 1. If category is W, use bit pattern 0.

Suppose you gave someone (who did not see the original image) the list of bits

00000000 00011000 00111100 01111110 01111110 01111110 00111100 00011000,

told them the zeros represented a white pixel and the ones represented a black pixel, and asked them to draw the object. What would they draw?

They would probably draw this:

Suppose that we digitize the same image but overlay the grid as shown in the second panel.

Grid used for first attempt at digitization.
Grid used for second attempt at digitization.

Following the same steps as above would result in a bit pattern of

00010000 00111000 01111100 11111110 01111100 00111100 00010111 00000000

And a restored image of

## 1.7. Comparison between result I and II

Result of first attempt at digitization
Result of second attempt at digitization

## 1.8. Photo digitization summary

At least two things should be apparent from this example:

1. The result of digitization depends on the method by which you break the image into pieces. In this example, the result depended on how we placed the grid on the image. The result will also depend on the size of the pieces used.
2. Digitization leads to a loss of information - given the final result of either digitization, a list of 1s and 0s which are then converted to the images shown on the previous slide, you could not say with certainty what the original image looked like.

# 2. Problems

## 2.1. Convert bit pattern to digitized image I

On a disk drive you find the following sequence:

000000011110010010010010011110000000

You are told that the pattern represents black and white pixels that forms an image that is 6 pixels by 6 pixels. In addition, you are told that the encoding rule is 0=white and 1=black. What does the image represent?

## 2.2. Convert bit pattern to digitized image II

On a disk drive you find the following sequence:

000000011110010010010010011110000000

You are told that the pattern represents black, white, green, and blue pixels that form a square image. In addition, you are told that the encoding rule is 00=black, 01=white, 10=green, and 11=blue.

Draw the image.

## 2.3. Digitizing an Image I

Digitize the following image using the encoding rule white=0, black=1. Write out the bit sequence that corresponds to the image. Write down the rule that you used to determine if a pixel (square) was to be black or white.

## 2.4. Digitizing an Image II

Digitize the following image using the encoding rule white=0, black=1. Write out the bit sequence that corresponds to the image. Write down the rule that you used to determine if a pixel (square) was to be black or white.

## 2.5. Digitizing measurements

Suppose we wanted to store a number on a computer, but were only allowed to use two bits to represent each measurement. The four possible bit patterns of length two are 00, 01, 10, and 11.

When reading the bits from memory, we can tell the computer that when it encounters a 00, this means the expression red. Therefore, if I wanted to save the list red green green red magenta, I could just write the bits 00 01 01 00 11. Now when I read back the bits, I know this person meant red green green red magenta. In a similar way, I can define these combinations of bits to mean numbers other than their decimal equivalent, two examples are shown in the "bit-pattern-to-meaning-table" shown to the right.

bit-pattern-to-meaning table
Bit pattern Meaning 1 Meaning 2
00 red 0
01 green -1
10 blue +1
11 magenta 2

Suppose that your instrument can take on decimal values of 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, and 4.0 and you want to represent each number as a group of three bits that form a "bit pattern". The first part of your "bit-pattern-to-meaning-table" would look like the table to the right.

bit-pattern-to-meaning table
Bit pattern Meaning
000 0.0
001 0.5
010 1.0
011 1.5
100 2.0
... ...

### 2.5.1. Part I

Suppose that you only have the choice of using three bits. How many unique combinations of 1s and 0s are possible?

### 2.5.2. Part II

Suppose that you get a new instrument that can measure values from 0.0, 0.1, 0.2, ..., 4.0, but you still store data using three bits and use the same "bit-pattern-to-meaning-table".

When you write a bit group to record a measurement, you choose the bit grouping that has the closest value to your measurement. In doing so, you lose precision much like when you round a decimal number 1.11111111 to 1.1. When you return to the number 1.1, you won't be able to tell if the original number was, for example, 1.11 or 1.12 because both numbers round to 1.1.

When you read back your measurements after representing each number on your disk as a group of three bits, what will be the largest difference between the read back value and the actual measured value? Explain your answer in words.

1. 0.1
2. 0.5
3. 0.4
4. 1.0
5. 2.0

# 3. Activities

## 3.1. Human Memory I

When the instructor says "go", try to memorize the following sequence.

000000011110010010010010011110000000

1. How many bits per second were you were able to memorize?
2. How does this compare to how many bits per second a computer can store? (Hint: Think about how long it takes you to copy a file from a thumb drive to a computer.)

## 3.2. Convert bit pattern to digitized image

On a disk drive you find the following sequence:

000000011110010010010010011110000000

You are told that the disk drive contained black and white pixels and formed an image that was 6 pixels by 6 pixels. What does the image represent?

## 3.3. Human Memory II

When the instructor says "go", try to memorize the following sequence.

000000111111001100001100001100001100

1. How many bits per second were you were able to memorize?
2. How does this compare to how many bits per second a computer can store? (Hint: Think about how long it takes you to copy a file from a thumb drive to a computer.)

## 3.4. Digitize an Image

In panel A of this file (handed out in class), an image is given with a grid overlayed. In panel B, draw a digitized version of the image on the left by filling in squares with black (squares must be all black or all white). Write down the algorithm that you used to determine what squares to fill in.

In panel D, draw in a digitized version of the top 20% of the image in panel C.

I will compare answers on the overhead after the activity is complete.

When you are finished, answer the following questions (you don't need to turn in your answer sheet).

How many more 1s and 0s do you need to digitize image C versus image A?

## 3.5. Other Digitization Discussion

1. How would you convert a color image to a sequence of 1s and 0s?
2. Sound is measured by the displacement of a membrane due to air pressure. Suggest a method for digitizing sound. (Don't look it up! Think about it first!)

# 4. Resources

• Paper on chemical analog to digital conversion: [1].