3. Image Sampling & Quantisation 3.1 Basic Concepts •To create a digital image, we need to convert continuous sensed data into digital form. •This involves two processes: sampling and quantisation •The basic idea behind sampling and quantization is illustrated in Fig. 3.1. • Figure 3.1(a) shows a continuous image, f (x, y), that we want to convert to digital form. • To convert it to digital form, we have to sample the function in both coordinates and in amplitude. • An image may be continuous with respect to the x- and y-coordinates and also in amplitude. • Digitizing the coordinate values is called sampling. • Digitizing the amplitude values is called quantization. Fig 3.1 Generating a digital image (a) Continuous image. (b) A scan line from A to B in the continuous image. (c) Sampling & quantisation. (d) Digital scan line. • The one-dimensional function shown in Fig. 3.1(b) is a plot of amplitute (gray level) values of the continuous image along the line segment AB in Fig. 3.1(a). • To sample this function, we take equally spaced samples along line AB, as shown in Fig. 3.1(c). • Location of each sample is given by a vertical tick mark in the bottom part of the figure. • The samples are shown as small white squares superimposed on the function. The set of these discrete locations gives the sampled function. • However, the values of the samples still span (vertically) a continuous range of gray-level values. • In order to form a digital function, the gray-level values also must be converted (quantized) into discrete quantities. • The right side of Fig. 3.1(c) shows the gray-level scale divided into eight discrete levels, ranging from black to white. • The vertical tick marks indicate the specific value assigned to each of eight gray levels. • The continuous gray levels are quantized simply by assigning one of the eight discrete gray levels to each sample. • The assignment is made depending on the vertical proximity of a sample to a vertical tick mark. • The digital samples resulting from both sampling and quantization are shown in Fig. 3.1(d) and Fig 3.2 (b). Fig. 3.2 (a) Continuous image projected onto a sensor array. (b) Result of image sampling and quantisation 3.2 Representing Digital Images • The result of sampling and quantisation is a matrix of real numbers as shown in Fig.3.3, Fig.3.4. and Fig 3.5. • The values of the coordinates at the origin are (x,y) = (0,0). • The next coordinate values along the first row are (x,y) = (0,1). • The notation (0,1) is used to signify the 2nd sample along the 1st row. Fig. 3.3. Coordinate convention used to represent digital images Fig. 3.4. A digital image of size M x N • It is advantageous to use a more traditional matrix notation to denote a digital image and its elements. Fig. 3.5 A digital image • The number of bits required to store a digitised image is • b=MxNxk Where M & N are the number of rows and columns, respectively. • The number of gray levels is an integer power of 2: • L = 2k where k =1,2,…24 • It is common practice to refer to the image as a “k-bit image” • The spatial resolution of an image is the physical size of a pixel in that image; i.e., the area in the scene that is represented by a single pixel in that image. • Dense sampling will produce a high resolution image in which there are many pixels, each of which represents of a small part of the scene. • Coarse sampling, will produce a low resolution image in which there are a few pixels, each of which represents of a relatively large part of the scene. Fig. 3.6 Effect of resolution on image interpretation (a) 8x8 image. (b) 32x32 image © 256x256 image Fig.3.7 Effect of quantisation on image interpretation. (a) 4 levels. (b) 16 levels. (c) 256 levels