Page 199 - MATLAB Recipes for Earth Sciences
P. 199

194                                                 8 Image Processing

            8.2 Data Storage

            Vector and raster graphics are the two fundamental methods for storing pic-
            tures. The typical format for storing vector data was already introduced in
            the previous chapter. In the following example, the two columns of the fi le
            coastline.txt represent the coordinates for the longitude and the latitude.

               NaN        NaN
               42.892067  0.000000
               42.893692  0.001760
               NaN        NaN
               42.891052  0.001467
               42.898093  0.007921
               42.904546  0.013201
               42.907480  0.016721
               42.910414  0.020828
               42.913054  0.024642
               (cont'd)
            The NaN·s help to identify break points in the data.
               The raster data are stored as 2D arrays. The elements of the array repre-
            sent altitude above sea level, annual rainfall or, in the case of an image, color
            intensity values.

               174 177 180 182 182 182
               165 169 170 168 168 170
               171 174 173 168 167 170
               184 186 183 177 174 176
               191 192 190 185 181 181
               189 190 190 188 186 183

            In all cases, raster data can be visualized as 3D plot. The x and y are the indi-
            ces of the 2D array or any other reference frame, and z is the numerical value
            of the elements of the array (see also Chapter 7). Alternatively, the numeri-
            cal values contained in the 2D array can be displayed as pseudocolor plot,
            which is a rectangular array of cells with colors determined by a colormap.
            A colormap is a m-by-3 array of real number between 0.0 and 1.0. Each row

            defines a red, green, blue (RGB) color. An example is the above array that
            could be interpreted as grayscale intensities ranging from 0 (black) to 255
            (white). More complex examples include satellite images that are stored in
            3D arrays.
               As discussed before, a computer stores data as bits, which have one out
            of two states, one and zero (Chapter 2). If the elements of the 2D array rep-
            resent the color intensity values of the pixels (short for picture elements) of
            an image, 1-bit arrays only contains ones and zeros.
   194   195   196   197   198   199   200   201   202   203   204