2.1.1 Exercises
For some of these exercises you will need access to Octave or Matlab software. The following exercises refer to images found in Figures 2.5 and 2.6.
1 See Page 39 for examples of non-rectangular geometric configurations. 2 An example of an operation on matrices that is meaningless on images is row reduction.
12 2 Vector Spaces
Image 1 Image 2
Image 3 Image 4
Fig. 2.6 Four additional images. Image 1 is (0.5)(Image A) and Image 2 is (Image 1)+(Image C).
1. Express Image 3 using arithmetic operations on Images A, B, and C. (Note that the pixel intensities in Image 3 are all either 4, 8, or 16.)
2. Express Image 4 using arithmetic operations on Images A, B, and C. (Note that the pixel intensities in Image 4 are all either 0 or 16.)
3. Input the following lines of code into the command window of Octave/Matlab. Note that ending a line with a semicolon suppresses terminal output. If you want to show the result of a computation, delete the semicolon at the end of its line. Briefly describe what each of these lines of code produces.
M_A = [0 0 8 8; 0 0 8 8; 8 8 0 0; 8 8 0 0]; M_B = [0 8 0 8; 8 0 8 0; 0 8 0 8; 8 0 8 0]; M_C = [8 0 0 8; 0 8 8 0; 0 8 8 0; 8 0 0 8];
figure(’position’, [0,0,1200,360]); GrayRange=[0 16];
subplot(1,3,1); imagesc(M_A,GrayRange); title(’Image A’);
subplot(1,3,2); imagesc(M_B,GrayRange); title(’Image B’);
subplot(1,3,3); imagesc(M_C,GrayRange); title(’Image C’);
colormap(gray(256));
2.1 Exploration:Digital Images 13
4. Enter the following lines of code one at a time and state what each does.
M_A M_1 = .5*M_A M_2 = M_1 + M_C figure(’position’, [0,0,1200,360]); GrayRange=[0 16]; subplot(1,2,1); imagesc(M_1,GrayRange); title(’Image 1’); subplot(1,2,2); imagesc(M_2,GrayRange); title(’Image 2’); colormap(gray(256));
5. Write your own lines of code to check your conjectures for producing Images 3 and/or 4. How close are these to Images 3 and/or 4?
6. We often consider display scales that assign pixels with value 0 to the color black. If a recording device uses such a scale then we do not expect any images it produces to contain pixels with negative values. However, in our definition of an image we do not restrict the pixel values. In this problem you will explore how Octave/Matlab displays an image with negative pixel values, and you will explore the effects of different gray scale ranges on an image. Input the image pictured below into Octave/Matlab. Then display the image using each of the following five grayscale ranges.
−10
10
0
5
20
−20
(i) GrayRange= [0, 20], (ii) GrayRange= [0, 50], (iii) GrayRange= [−20, 20], (iv) GrayRange= [−10, 10], (v) GrayRange= [−50, 50].
(a) Describe the differences in the display between: setting (i) and setting (ii); setting (i) and setting (iii); setting (iii) and setting (iv); and finally between setting (iii) and setting (v).
(b) Summarize what happens when pixel intensities in an image exceed the display range as input into the imagesc function.
(c) Summarize what happens when the display range becomes much larger than the range of pixel values in an image.
(d) Discuss how the pixels with negative values were displayed in the various gray scale ranges.
7. How should we interpret pixel intensities that lie outside our specified grayscale range? 8. Consider digital radiographic images (see Figure 1.1). How would you interpret intensity values?
How would you interpret scalar multiplication? 9. What algebraic properties does the set of all images have in common with the set of real numbers? 10. Research how color digital images are stored as numerical values. How canwemodify our concepts
of image addition and scalar multiplication to apply to color images?
14 2 Vector Spaces
11. Describe how a heat state on a rod can be represented as a digital image. 12. Think of two different digital image examples for which negative pixel intensities make real-world
sense.
2.2 Systems of Equations
In Section 2.1, we considered various 4 × 4 images (see page 11). We showed that Image 2 could be formed by performing image addition and scalar multiplication on Images A, B, and C. In particular,
(Image 2) = ( 1
2
) (Image A) + (0)(Image B) + (1)(Image C).
We also posed the question about whether or not Images 3 and 4 can be formed using any arithmetic operations of Images A, B, and C. One can definitely determine, by inspection, the answer to these questions. Sometimes, however, trying to answer such questions by inspection can be a very tedious task. In this section, we introduce tools that can be used to answer such questions. In particular, we will discuss the method of elimination, used for solving systems of linear equations. We will also use matrix reduction on an augmented matrix to solve the corresponding system of equations. We will conclude the section with a key connection between the number of solutions to a system of equations and a reduced form of the augmented matrix.
2.2.1 Systems of Equations
In this section we return to one of the tasks from Section 2.1. In that task, we were asked to determine whether a particular image could be expressed using arithmetic operations on Images A, B, and C. Let us consider a similar question. Suppose we are given the images in Figures 2.7 and 2.8. Can Image C be expressed using arithmetic operations on Images A, D, and F?
For this question, we are asking whether we can find real numbers α,β, and γ so that
Image C
= α ·
Image A
+ β ·
Image D
+ γ ·
Image F
.
(2.1)
Image A Image B Image C
Fig. 2.7 Images A, B, and C from Section 2.1.
2.2 Systems of Equations 15
Image D Image E Image F
Fig. 2.8 Images D, E, and F are more example 16-pixel images.
First, in order to make sense of this question, we need to define what it means for images to be equal.
Definition 2.2.1
Let I1 and I2 be images. We say that I1 = I2 if each pair of corresponding pixels from I1 and I2 has the same intensity. �
The convention in Figure 2.4, Definition 2.2.1, andEquation 2.1 give us ameans towrite an equation, corresponding to the upper left pixel of Image D,
8 = 0α + 4β + 8γ. (2.2)
This equation has a very specific form: it is a linear equation. Such equations are at the heart of the study of linear algebra, so we recall the definition below.
Definition 2.2.2
A linear equation is an equation of the form
a1x1+a2x2+ · · · + anxn = b,
where b ∈ R, a1, · · · , an ∈ R are called coefficients and x1, x2, . . . , xn are called variables. �
In the definition above, we use the symbol “∈” and mean “element of” or “in the set.” We write, above, that b ∈ R. This means that b is an element of the set of all real numbers. Typically, we read this as “b is real.” We will use this notation throughout the text for many different sets.
This definition considers coefficients which are real numbers. Later, we will encounter some generalizations where coefficients are elements of other fields. See Appendix D for a discussion of fields. Let us consider some examples of linear equations.
Example 2.2.3 The equation 3x + 4y − 2z = w
is linear with variables x , y, z, and w, and with coefficients 3, 4,−2, and −1 we see this by putting the equation in the form given in Definition 2.2.2. In this form, we have
3x + 4y − 2z − w = 0.
16 2 Vector Spaces
�
The form given in Definition 2.2.2 will often be referred to as standard form. We now follow with some equations that are not linear.
Example 2.2.4 The following equations are not linear:
3x + 2yz = 3
x2 + 4x = 2
cos x − 2y = 3.
As we can see, in each equation above, operations applied on the variables that are more complicated than addition and multiplication by a constant coefficient. �
Let us, now, return to the question at hand. In Equation 2.2, the variables are α,β, and γ. We seek values of these variables so that the equation is true, that is, so that both sides are equal. Appropriate values for α,β, and γ constitute a solution to Equation 2.2, which we define below.
Definition 2.2.5
Let a1x1 + a2x2 + · · · + anxn = b
be a linear equation in n variables, x1, x2, · · · , xn . Then
(v1, v2, · · · , vn) ∈ R n
is a solution to the linear equation if
a1v1 + a2v2 + · · · + anvn = b.