Matrices and Pictures

advertisement
GK-12 Sensors!
Portable Module
Matrices and Pictures
Lesson 1: Introduction to digital pictures
Anthony Puckett
Introduction:
Did you know that matrices are used to represent pictures? Computers talk and
think in numbers. So, for a computer to process a picture, the picture must be
converted to numbers. A matrix is used to store these numbers. The indices of
the matrix, i.e. (1,2) represent a location on a picture. The value of the element at
that location in the matrix represents a color. The color is prescribed by a color
map, which defines the color for each number.
Show slide 2. (Slide of flowers, matrix, and colormap)
Analog vs. digital
Computers are digital. What does digital mean, and how does it differ from
analog? Something that is digital has specific discrete values that it can represent,
where as something that is analog has an infinite number of values that it can
represent. (This is independent of accuracy.) For instance, a digital clock can
only display 12:00 or 12:01, but nothing in between. An analog clock can display
any value between 12:00 and 12:01. A more accurate digital clock might also
display the seconds, in which case the clock could display 12:00:59 and 12:01:00,
but nothing in between. Can you think of other things that are either digital or
analog?
Show slide 3. (Slide of digital and analog clocks)
To store pictures digitally, analog values must be converted to digital values.
This can be done a number of ways. Real numbers might be rounded to the
nearest integer. For the digital clock, the minute place always rounds down, so
12:00:59 is displayed as 12:00. Not until 12:01:00 is 12:01 displayed.
Digital pictures are digital in two ways. First, a matrix that represents a picture
has a finite number of rows and columns, i.e. 19x25. Therefore, only 475
locations can be represented.
Show slide 4. (extra-coarse picture of Black-eyed Susan)
Just like the digital clock was more accurate when the seconds were added to the
display, the digital picture is more accurate when there are more pixels available
to represent an image.
Show slide 5. (coarse picture of Black-eyed Susan)
Even more pixels will represent the image more accurately. If all the pictures are
presented so that the pixels are the same size, the relative size of the pictures is
apparent.
Show slide 6. (fine-picture of Black-eyed Susan with other pictures)
Digital pictures can only represent a finite number of colors, the second way
digital pictures are digital. A simple digital picture might be represented by only
256 colors. A more accurate digital picture might be represented by 24 bit color,
which is millions of colors (24 bit means 2 to the 24th power, which equals
16,777,216). Optional: if there is time number bases could be discussed to show
how 24 bit, which is base 2, is 2 to the 24th power.
Show slide 7. (extra-fine picture of Black-eyed Susan)
What would the analog equivalent be of a digital picture? In other words what
would make an analog picture? Hint: They have been around for more than one
hundred years (film camera).
How are digital picture created?
How many of you are taking chemistry? You will learn about some of this
information later in chemistry.
Digital pictures can be created a number of ways such as scanners and digital
cameras. Digital pictures can also be created from information. Let’s first talk
about digital cameras. Digital cameras capture pictures using a sensor called a
charge-coupled device (CCD). The CCD consists of an array/matrix of pixels.
Each pixel produces a charge proportional to the number of photons striking the
pixel. The camera converts this charge to a number, and this number is stored in
the matrix at the same row and column as the pixel.
Show slide 8 (CCD)
The CCD can not differentiate colors. It can only measure the number of photons,
which corresponds to the intensity or brightness. Therefore, we need to talk about
the electromagnetic spectrum.
Show slide 9 (Electromagnetic spectrum – Lawrence Berkeley Lab)
The electromagnetic spectrum extends from gamma rays and x-rays through the
visible spectrum to radio frequency waves, which are used for AM, FM radio and
cell phones. Our eyes can see the electromagnetic waves in the visible region of
the spectrum, which corresponds to light with wavelengths between 400 nm and
750 nm.
In order to capture a single color a filter is needed to filter out all of the colors
except one. The filters are green, blue and red. Therefore, in order to make color
pictures the camera needs 3 CCDs, each one for measuring a different color.
Show slide 10 (3 CCDs)
Alternatively each pixel can measure a different color.
Show slide 11 (Bayer filter – Howstuffworks.com)
So the picture does not look funny at each pixel the red, green, and blue values are
averaged from the neighboring pixels.
Number of Pixels and Digital Zoom
Recall that the digital clock was more accurate when the seconds digits were
added to the display. Similarly the representation of a picture is more accurate
when there are more pixels. A camera that has 4 Megapixels (i.e. 4 million
pixels) produces a more detailed picture than a camera that has a 1 Megapixels.
Digital cameras often advertise the digital zoom capabilities of the camera. When
a camera zooms digitally, it is looking at a smaller matrix of the pixels at the
center of the CCD. Since there are fewer pixels the quality is poorer than an
optical zoom in which the number of pixels stays the same.
(Optional: If you have a digital video camera that can be plugged into a TV or
LCD projector the digital zoom can be demonstrated.)
Other Sensors and Examples of Pictures and Matrices
Other sensors look at other regions in the electromagnetic spectrum, but still use
arrays of sensors to produce a matrix of numbers that represent a measurand (i.e.
bone density, heat). Even though these other regions cannot be seen, colors can
be assigned to the values to produce a picture
Infrared cameras look at the infrared portion of the electromagnetic spectrum.
Every object that is above absolute zero emits infrared electromagnetic waves and
the intensity is proportional to the temperature of the object.
Show slide 12. (Infrared image of hot power lines – FLIR Systems)
(Optional: If you have a digital video camera that has night vision you can
demonstrate the infrared range by turning off all of the lights in the room.)
Now days when you go to the dentist they might have a digital X-ray camera,
which will show the X-ray on the screen immediately. The number of the X-rays
received by the sensor is inversely proportional to the density, i.e. fewer X-rays
will travel through the denser bone than the less dense muscle.
Show slide 13. (Digital X-rays – General Electric)
In science and engineering a lot of data is produced either from math calculations
or from experiments. One way to represent all of the data is with pictures. By
assigning colors to the numbers a visual representation of the data is created.
What if colors were assigned based on your grade, and the seating chart was used
as the matrix to make a picture.
Show slide 14. (Grades)
Engineers use a technique called Finite Element Analysis to determine the
stresses in structures. The stresses that are calculated can be represented by colors
to help identify locations where there might be a failure. This picture shows a hip
joint replacement and the stresses it produces in the bone with and without
loading
Show slide 15. (Finite Element Analysis - ABAQUS)
Activity: Pictures and Matrices
Each student will act like a CCD. The students will take a sheet of graph paper. In the
upper portion of the paper they should draw a picture inside of a 15x15 grid using up to 8
colors. Each box should only be one color. The student should develop a color map
relating the colors to an integer. On the lower portion of the paper the student should fill
in another 15x15 grid with the corresponding integers of the colors in the upper box.
Download