This time, we will not import just the bands belonging to the visible spectrum, but all seven bands. We will play around a little bit with the resulting images, trying to justify the importance of the bands. Let's start:
>> multi = multibandread('rio.lan', [512, 512, 7],... 'uint8=>uint8',128, 'bil', 'ieee-le'),
To prove that we have indeed loaded all seven channels, let's check the size of our resulting matrix:
>> size(multi)
The output of the previous code is as follows:
ans = 512 512 7
>> rgb = cat(3,multi(:,:,3),multi(:,:,2),multi(:,:,1)); >> for i=1:size(rgb,3) adjusted(:,:,i) = imadjust(rgb(:,:,i)); end
>> subplot(2,4,1),imshow(multi(:,:,1)),title('Band 1: Blue') >> subplot(2,4,2),imshow(multi(:,:,2)),title('Band 2: Green') >> subplot(2,4,3),imshow(multi(:,:,3)),title('Band 3: Red') >> subplot(2,4,4),imshow(adjusted),title('Contrast adjustedRGB') >> subplot(2,4,5),imshow(multi(:,:,4)),title('Band 4: Near-IR') >> subplot(2,4,6),imshow(multi(:,:,5)),title('Band 5: Short-IR1') >> subplot(2,4,7),imshow(multi(:,:,6)),title('Band 6: Thermal-IR') >> subplot(2,4,8),imshow(multi(:,:,7)),title('Band 7: Short-IR 2')
>> nearIR = cat(3, multi(:,:,4), multi(:,:,3), multi(:,:,2));
>> shortwIR = cat(3, multi(:,:,7), multi(:,:,4), multi(:,:,2));
>> subplot(1,3,1),imshow(adjusted),title('Contrast adjusted RGB') >> subplot(1,3,2),imshow(nearIR),title('Near Infrared') >> subplot(1,3,3),imshow(shortwIR),title('Shortwave Infrared')
In this example, we worked on the manipulation of more than the visible bands. We loaded all seven bands of the file into one matrix and then mixed some of them to create resulting images that make valuable details more visible. The purpose of this section was not to make you a geospatial imagery expert, but to provide you with some insight into what the invisible layers of an image might be. Furthermore, we tried to offer an alternative solution to the analysis of geospatial data, since MATLAB can also be used for these applications. Since you got the idea on how to visualize these images, you can mix the techniques presented here with some of the methods described in previous chapters to enhance, filter, or even mask the results. The sky is the limit!
The characterization of the bands is based on information found here: http://landsat.usgs.gov/best_spectral_bands_to_use.php. You can visit the page to find a little more information about the usefulness of each band. Some more ideas on how to work with these images can be found at http://zulu.ssc.nasa.gov/mrsid/tutorial/Landsat%20Tutorial-V1.html.