Digitization
From ComputingForScientists
Contents 
1. Digitization
1.1. Objectives
 To define digitization.
 To understand the process by which information is converted to
0
s and1
s.
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
1
s and0
s for storage on a digital computer.
1.4. 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.
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 
Day Rain Amount 1 00 2 01 3 10 4 11 
In terms of the digitization steps
 Draw the boundary lines for the pieces  Drew lines for the boundaries of 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 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 onehalf 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.
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
1.8. 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 used.
 Digitization leads to a loss of information  given the final result of either digitization, a list of
1
s and0
s 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?
Answer 

The bit pattern:

The image:

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.
Answer 


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.
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

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.
Answer 

Rule: If any square contains more than 50% black, color the square black. 


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 

Suppose that your instrument can take on decimal values of 

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

Continue from the previous table:
or use the following equation: N_{patterns} = 2^{Nbits} = 2^{3 bits} = 8 bits 
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 "bitpatterntomeaningtable".
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.
 0.1
 0.5
 0.4
 1.0
 2.0
Answer  

B. Using the previous table:
If you had 3.5, it would be represented as 
3. Activities
3.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.)
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
 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.)
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 1
s and 0
s 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 square is 50 or more percent filled, color black. 
Alternative algorithm: If square has any black, color black. 
3.5. Other Digitization Discussion
 How would you convert a color image to a sequence of
1
s and0
s?  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].