Page 202 - MATLAB Recipes for Earth Sciences
P. 202

8.2 Data Storage                                                197

           the one we use in the following chapter. If each pixel needs 8 bits to store an
           grayscale value, the memory required by the data is 729x713x8=4,158,216
           bits or 4,158,216/8=519,777 bytes. This number is exactly what we obtain
           by typing whos in the command window. Common prefi xes for bytes are
           kilobyte, megabyte, gigabyte and so forth.
             bit = a 1 or 0 (b)
             8 bits = 1 byte (B)
             1024 bytes = 1 Kilobyte (KB)
             1024 Kilobytes = 1 Megabyte (MB)
             1024 Megabytes = 1 Gigabyte (GB)
             1024 Gigabytes = 1 Terabyte (TB)

           It is important to note that in data communication 1 kilobit = 1,000 bits, while
           in data storage 1 kilobyte = 1,024 bytes. A 24-bit or  true color image then
           requires three times the memory needed to store a 8-bit image, or 1,559,331
           bytes = 1,559,331/1,024 kilobytes (KB) § 1,523 KB § 1,559,331/1,024  =
                                                                           2
           1.487 megabytes (MB).
             In many cases, however, the dimension of an image is not given by the
           total number of pixels, but the length and height of the picture and its reso-
           lution. The resolution of an image is the number of  pixels per inch ( ppi) or
           dots per inch ( dpi). The standard resolution of a computer monitor is 72 dpi
           although modern monitors often have a higher  resolution such as 96 dpi. As
           an example, a 17 inch  monitor with 72 dpi resolution displays 1,024x768
           pixels. If the monitor is used to display images at a different (lower, higher)
           resolution, the image is resampled to match the monitor·s resolution. For
           scanning and printing, a resolution of 300 or 600 dpi is enough in most
           applications. However, scanned images are often scaled for large printouts
           and therefore have higher resolutions such as 2,400 dpi. The image used in
           the next chapter has a width of 25.2 cm (or 9.92 inch) and a height of 25.7
           cm (10.12 inch). The resolution of the image is 72 dpi. The total number of
           pixels is therefore in horizontal direction 72*9,92 § 713, the vertical number
           of pixels is 72 *10,12 § 729, as expected.
             Numerous formats are available to save vector and raster data into a fi le.
           These formats all have their advantages and disadvantages. Choosing one
           format over another in an application requires a good knowledge of the

           characteristics of the various file formats. This knowledge is particularly
           important if images are to be analyzed quantitatively. The most popular for-
           mats for storing vector and raster data are:

           1. Compuserve Graphics Interchange Format (GIF) – This format was de-

             veloped in 1987 for raster images using a fixed colormap of 256 colors.
   197   198   199   200   201   202   203   204   205   206   207