Before diving straight into image processing, let's understand images first. An image, as humans see it, is a two-dimensional grid with each cell in the grid filled with a color value, otherwise called a pixel value. Each cell of the grid is formally called a picture element (commonly abbreviated to pixel). A computer also sees the image in the same way. An image on a computer is a two-dimensional matrix of numbers with each cell in the matrix storing the corresponding pixel value(s) in the image. The following figure is an example of an image matrix. The matrix of the portion of the image in the red box is shown on the right:

Figure 1: This is the image matrix (right), as stored on a computer, of a small ...