An image is an array of pixels (picture elements) arranged in columns and rows. So image is a collection of discrete (and usually small) cells, which is known as pixel in image processing. In a 8-bit greyscale image each picture element has an assigned intensity that ranges from 0 to 255. A grey scale image will include many shades of grey as show below.
In the above image, each pixel has a value from 0 (black) to 255 (white). Possible range of the pixel values depend on the colour depth of the image. Here each pixel is represented by 8 bit = 256 (2^8) tones or greyscales. Some greyscale images have more greyscales levels, for instance 16 bit = 65536 greyscales.
Pixel
A digital image is divided into a rectangular grid of pixels, so that each pixel is itself a small rectangle. Once this has been done, each pixel is given a pixel value that represents the color of that pixel. It is assumed that the whole pixel is the same color, and so any color variation that did exist within the area of the pixel before the image was discretized is lost. If the area of each pixel is very small, then the discrete nature of the image is often not visible to the human eye.
In the above figure, left side is the actual image. Right hand side shows the corresponding pixel value for each cell.
Pixel Values
Each of the pixels that represents an image stored inside a computer has a pixel value which describes color value. For a grayscale images, the pixel value is a single number that represents the brightness of the pixel. Pixel value zero is taken to be black, and 255 is taken to be white. Values in between make up the different shades of gray.
To represent color images, separate red, green and blue components must be specified for each pixel (assuming an RGB colorspace). Different components are stored as three separate grayscale images known as color planes (one for each of red, green and blue).
Below image shows the image and associated coordinates system. (0,0) coordinate starts from top left corner of the image as shown below. A pixel is located using x and y coordinate. At coordinate (1,1), the pixel values of the cell is (255,255,0). So Red channel value is 255, Green channel value is 255 and Blue channel value is 0.
Multi-spectral images can contain even more than three components for each pixel, and by extension these are stored in the same kind of way, as a vector pixel value, or as separate color planes.
Usually 8-bit integers are the most common sorts of pixel values used. Some image formats support different types of value, for instance 32-bit signed integers or floating point values. Such values are useful in image processing as they allow processing to be carried out on the image where the resulting pixel values are not necessarily 8-bit integers.