Digitization
From CDS 130
Contents 
1. Objectives
 To define digitization.
 To understand the process by which information is converted to 0s and 1s.
2. Motivation
 Computers store information in binary. Conversion of information to binary numbers requires digitization.
3. Priming questions
 You are given the task of representing a black and white picture as bits. You will pay someone to do the actual work, but they need explicit instructions. What are your instructions?
4. Notes
4.1. 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.
4.2. Digitization Steps
 Draw the boundary lines for the pieces
 Decide what category each piece is in
 Assign a bit pattern to each category
The last step amounts to creating your own encoding table for the list of all possible categories.
4.3. 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 or rain, and more than 2 inches or rain. Instead of writing out the words, I use bit patterns 
Day Rain Amount 1 00 2 01 3 00 4 10 5 11 
In terms of the digitization steps
 Draw the boundary lines for the pieces  Drew lines for different levels of rain.
 Decide what category each piece is in  Decided to use less than 1 inch, 12 inches, and more than 2 inches.
 Assign a bit pattern to each category  Decided to use a twobit bit pattern.
Paper on chemical analog to digital conversion: [1].
4.4. Digitizing a photo I
We are going to digitize a black and white photo of a shape.
4.5. Digitizing a photo I
Step 1: Draw the boundary lines for the pieces  Overlay a grid; the squares represent the pieces.
4.6. Digitizing a photo I
Step 2: Decide what category each piece is in  If more than onehalf of the square is black, label square as "B". Otherwise, labels as "W".
4.7. Digitizing a photo I
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
.
4.8. Digitizing a photo I
Suppose that you gave someone, who did not see the original image, the list of bits
00000000 00011000 00111100 01111110 01111110 01111110 00111100 00011000
,
told them that zeros represented a white pixel and ones represented a black pixel, and asked them to draw the object. What would they draw?
4.9. Digitizing a photo I
They would probably draw this:
4.10. Digitizing a photo II
Suppose that we digitize the same image but overlay the grid as shown in the second panel.
4.11. Digitizing a photo II
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
4.12. Digitizing a photo comparison
4.13. Photo digitization summary
At least two things should be apparent from this example:
 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 that you use.
 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.
5. Questions
5.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. What does the image represent?
5.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.
5.3. Digitizing and 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.
Answer 

Two possible answers are given below. Rule: If any square contains black, color the square black. The corresponding bit sequence is
Rule: If any square contains more than 50% black, color the square black. The corresponding bit sequence is

5.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.
5.5. Digitizing and Image III
5.6. Digitizing measurements
Suppose that 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 

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 "bitpatterntomeaningtable" would look like the table to the right. 

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

2^{3} = 8. 
5.6.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 "bitpatterntomeaningtable".
When you write a bit group to record a measurement, you chose 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 the both 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.
 0.1
 0.5
 0.4
 1.0
 2.0
Answer 

If the table is continued, the 
6. Activities
6.1. Human Memory I
When the instructor says "go", try to memorize the following sequence.
000000011110010010010010011110000000
 How many bits per second were you were able to memorize?
 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.)
6.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?
6.3. Human Memory II
When the instructor says "go", try to memorize the following sequence.
000000111111001100001100001100001100
 How many bits per second were you were able to memorize?
 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.)
6.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?
Answer 

The following are two possible methods of digitizing the images. Note that
Algorithm: If sqaure is 50 or more percent filled, color black. Alternative algorithm: If sqaure has any black, color black. 
6.5. Other Digitization Discussion
 How would you convert a color image to a sequence of 1s and 0s?
 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!)
6.6. Digitization
Introduction
This lab activity is designed to introduce you to a process called digitization You'll demonstrate this process by digitizing a blackandwhite image, and then answer a few questions about the process. Along the way you'll learn how images are reduced to binary representations and develop a feel for the size of digitized images. This lab activity also introduces the notion of an algorithm, but not explicitly. For now just pay attention to the “cookbook” steps that you're asked to follow and note that by following these steps in order, you're able to perform specific tasks. But before jumping right in, it will be useful to define what we're going to do.
What is digitization?
Here's a simple definition:
Digitization means breaking something up into pieces.
That's pretty much it. Of course, it's natural to wonder why we would want to digitize something. The answer is that by digitizing something, we bring it into a form that's much easier for a computer to process.
Example 1: A DIGITAL color photograph is a digitization: It's a checkerboard grid pattern of blocks, each of which is colored only one of several color choices. That is, the original image is broken up into colored blocks  it is digitized.
Example 2: A DIGITAL black and white photograph is a digitization: It's a checkerboard grid pattern of blocks, each of which is colored (only!) black or white. the original image is broken up into black and white blocks  it is digitized.
Digitization of a black and white image
It's easy to digitize a blackandwhite image by following these steps in order:
 Obtain a black and white image with a checkerboard grid pattern overlay stenciled onto it (see #Resources). Also obtain two sheets of paper with only a checkerboard grid pattern stenciled onto them (again, see Section 6.5, "Resources").
 Begin in the top row, first square on the left, in the checkerboard grid pattern overlaid on the original image.
 Decide: Is this block ALL black, or is it ALL white? (NO "inbetween" decisions are allowed yet  that is, no "gray" is allowed!)
 Implement your decision in the corresponding block of the checkerboard grid pattern, ON THE SEPARATE SHEET OF WHITE PAPER: That is, if you decide a block of the original image is black, then BLACKEN THE CORRESPONDING BLOCK ON THE SEPARATE SHEET OF WHITE PAPER. But if you decide instead that a block of the original image is white, then DO NOT BLACKEN THE CORRESPONDING BLOCK ON THE SEPARATE SHEET OF WHITE PAPER.
 If you're at the end of a checkerboard grid pattern row, then move down one row and over to the first block (leftmost block) in this new row. Go to Step 3. If you're at the end of the checkerboard grid pattern's last row, then stop. Otherwise, move one block to the right and go to step 3.
That's it! You now have, on the first separate sheet of white paper, a blackandwhite digitization of the original blackandwhite image.
Questions
 Write down the rule(s) you used to decide whether any given checkerboard grid pattern block was black or white. Did you write down only one rule, or more than one rule?
 If you wrote down more than one rule, why was that necessary, that is, why did you decide that only one decision rule wasn't adequate?
 If you wrote down only one rule, will that rule work in all circumstances (that is, for all checkerboard grid pattern blocks overlaid on the original image)? If not, why not?
 Now produce a binary digitization of your blackandwhite digitization, as follows:
 Begin in the top row, first square on the left, in the blackandwhite digitization you produced.
 If this block is colored black, then on the SECOND separate sheet of white paper, in the corresponding block, enter the number 1. If the block is not colored black, then on the SECOND separate sheet of white paper, in the corresponding block, enter the number 0.
 If you're at the end of a checkerboard grid pattern row on your blackandwhite digitization, then move down one row and over to the first block (leftmost block) in this new row. Go to Step 42. If you're at the end of the checkerboard grid pattern's last row, then stop. Otherwise, move one block to the right and go to step 42.
 The binary digitization has dimensions: We can measure it's length, in blocks, and also its width in blocks. The total number of blocks contained in the binary digitization is simply the area of a rectangle  that is, the length times the width: an image having a length of 10 blocks and a width of 10 blocks will contain 100 total blocks. Now, each of these blocks will contain either a 1 or a 0 (because it's a binary digitization!) and so, remembering from our our study of binary numbers that each 1 or 0 is represented by one BIT, each individual block of the binary digitization will contain ONE BIT (or, can be represented by ONE BIT). Thus, a binary digitization comprised of 100 total blocks would contain (or, be represented by) 100 BITS. Now calculate the total number of bits contained in the binary digitization you produced in Question 4. Next, calculate the total number of bytes in this binary digitization (round UP to the nearest whole number of bytes).
 Do you think that the number of bits you calculated in Question 5 is dependent upon the RULES that you wrote down in Question 1 to decide whether any given block in the original image is all black or all white? Why or why not?