Geoscience Reference
In-Depth Information
8.3 Importing, Processing and Exporting Images
We i rst need to learn how to read an image from a graphics i le into the
workspace. As an example we use a satellite image showing a 10.5 km by 11
km subarea in northern Chile:
http://asterweb.jpl.nasa.gov/gallery/images/unconform.jpg
h e i le unconform.jpg is a processed TERRA-ASTER satellite image that can
be downloaded free-of-charge from the NASA web page. We save this image
in the working directory. h e command
clear
I1 = imread('unconform.jpg');
reads and decompresses the JPEG i le, imports the data as a 24-bit RGB
image array and stores it in a variable I1 . h e command
whos
shows how the RGB array is stored in the workspace:
Name Size Bytes Class Attributes
I1 729x713x3 1559331 uint8
h e details indicate that the image is stored as a 729-by-713-by-3 array,
representing a 729-by-713 array for each of the colors red, green and blue. h e
listing of the current variables in the workspace also gives the information
uint8 array, i.e., each array element representing one pixel contains 8-bit
integers. h ese integers represent intensity values between 0 (minimum
intensity) and 255 (maximum). As an example, here is a sector in the upper-
let corner of the data array for red:
I1(50:55,50:55,1)
ans =
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
We can now view the image using the command
imshow(I1)
Search WWH ::




Custom Search