1 What is a Raster image?

• An image is a 2D rectilinear array of pixels

1.1 Raster is a German word for grid**.**

  1. output device
  2. input device
    1. digital cameras

raster: grid, matrix, 2d array, tensor

1.2 An example

from numpy import random as r
I = r.rand(256,256);
from matplotlib import pyplot as p
from numpy import random as r
I = r.rand(256,256);
p.imshow(I);
p.show();

Untitled

  1. This code will actually produce an image like this:
  2. matplotlib assumes the data is ‘scientific’ and applies a colourmap.
  3. Note: matplotlib and colour maps.

Untitled

from matplotlib import pyplot as p
from numpy import random as r
I = r.rand(256,256);
p.imshow(I,cmap=‘gray’);
p.show();

Untitled

Next issue: matplotlib will normalize input e.g., map the lowest value to 0, and the highest to 1. Even though we multiplied by 0.5, the overall brightness is the same.

from matplotlib import pyplot as p
from numpy import random as r
I = r.rand(256,256)*0.5;
p.imshow(I,cmap=‘gray’);
p.show();

Untitled