Math 22b Spring 2019
22b Linear Algebra and Vector Analysis
Image Space - Vector Space
The space M(n,m) of n x m matrices is a linear space. Its dimension is n m. A general linear map from M(n,m) to M(n,m) is therefore described by a (nm x nm) matrix.It might appear a bit strange at first to think of a matrix itself as a vector. But it is very natural from the computer science point of view: memory in a computer is stored in a one-dimensional way. Also pictures are stored as one-dimensional vectors. One just has to include the additional information where to break the lines and voila, the picture is there.
Here is an example: if you build a file 22b.pnm" with a text editor, (just copy paste the following lines into a file and save it as 22b.pnm), then, when opening it with an image view, you see a picture. (here is the text file). The P3 entry tells that we encoded a color picture. The 12 and 5 gives the dimension of the picture. Then comes an indication that 1 is the size. Now starts the stream of pixels. It starts with (0,0,1) which is blue, etc. The last pixel is (1,0,0) which is red.
P3 12 5 1 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 0 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0
b b b 0 b b b 0 y r r r 0 0 b 0 0 0 b 0 y r 0 r b b b 0 b b b 0 y r r r b 0 0 0 b 0 0 0 y r 0 r b b b 0 b b b 0 y r r r
The browser however interpolates the colors. Here is how it really looks like
when looking at the 60 pixels: