Matlab讀取高光譜遙感資料
- 1、高光譜遙感資料簡介
- 2、兩個開源的高光譜遙感資料集
- 3、高光譜遙感資料常用格式
- 3.1 .Mat
- 3.2 .Tif
- 4、Matlab讀取高光譜遙感資料
- 4.1 Matlab讀取.Mat格式的高光譜遙感資料
- 4.1.1 Matlab代碼讀取.mat
- 4.1.2 運行結果(整合后):
- 4.2 Matlab讀取.tif格式的高光譜遙感資料
- 4.2.1 Matlab代碼讀取.tif
- 4.2.2 運行結果(整合后):
1、高光譜遙感資料簡介
遙感影像具有四種解析度:時間解析度、空間解析度、輻射解析度和光譜解析度,其中,對于光譜解析度而言,按照成像傳感器波譜通道劃分數目的多少,分為多光譜、高光譜和超光譜,通常認為,多光譜波段數目在100以下,高光譜波段數目在100~10000之間,超光譜波段數目在10000以上
2、兩個開源的高光譜遙感資料集
Hyperspectral Remote Sensing Scenes:包含Indian Pines、Salinas、Pavia Centre and University、Cuprite、 Kennedy Space Center、Botswana、anomaly detection(7個地區),在每個地區都會有介紹型別數量、波段數,可直接下載,

Hyperspectral Images:Portion of Southern Tippecanoe County, Indiana、Northwest Tippecanoe County, Indiana、Washington DC Mall,

這里,我只下載了Washington DC Mall Image的資料,如下圖所示:

3、高光譜遙感資料常用格式
3.1 .Mat

3.2 .Tif

4、Matlab讀取高光譜遙感資料
4.1 Matlab讀取.Mat格式的高光譜遙感資料
這里以Salinas.mat為例,首先打開Matlab軟體,進入下載的高光譜遙感資料目錄,作為作業空間;然后修改輸入檔案名后運行以下代碼,

4.1.1 Matlab代碼讀取.mat
load('Salinas.mat')
InputMatImg=salinas;
b = size(InputMatImg);
fprintf('輸入影像寬度為 %d\n',b(1));
fprintf('輸入影像高度為 %d\n',b(2));
fprintf('輸入影像波段數為 %d\n',b(3));
i=120;j=180;k=220;%自選三個波段
InputImg_r= InputMatImg(:,:,i);%獲取第i個波段
InputImg_g= InputMatImg(:,:,j);%獲取第j個波段
InputImg_b= InputMatImg(:,:,k);%獲取第k個波段
InputImg_r= uint8(InputImg_r);%將i波段的灰度值轉為0~255
InputImg_g= uint8(InputImg_g);%將j波段的灰度值轉為0~255
InputImg_b= uint8(InputImg_b);%將k波段的灰度值轉為0~255
RGBImg=cat(3,InputImg_r,InputImg_g,InputImg_b);%將i、j、k三個波段進行合成
figure;
subplot(221);imshow(InputImg_r);title('紅色波段');
subplot(222);imshow(InputImg_g);title('綠色波段');
subplot(223);imshow(InputImg_b);title('藍色波段');
subplot(224);imshow(RGBImg);title('合成波段');
imwrite(InputImg_r,['MATBand',num2str(i),'.jpg']);
imwrite(InputImg_g,['MATBand',num2str(j),'.jpg']);
imwrite(InputImg_b,['MATBand',num2str(k),'.jpg']);
imwrite(RGBImg,'compositeMATRGBimg.jpg');
4.1.2 運行結果(整合后):
第120波段
|
第180波段
|
第220波段
|
三波段組合
|
Salinas_gt
4.2 Matlab讀取.tif格式的高光譜遙感資料
這里以dc.tif(Washington DC Mall)為例,首先進入檔案所在目錄:

Matlab代碼功能:獲取第i、j、k三個波段,然后合成三個波段.
4.2.1 Matlab代碼讀取.tif
InputTIFImage = importdata('dc.tif');
Info=imfinfo('dc.tif')
i=130;j=160;k=190;%自選三個波段
InputImage_r= InputTIFImage(:,:,i);%獲取第i個波段
InputImage_g= InputTIFImage(:,:,j);%獲取第j個波段
InputImage_b= InputTIFImage(:,:,k);%獲取第k個波段
Image_r= uint8(InputImage_r);%將i波段的灰度值轉為0~255
Image_g= uint8(InputImage_g);%將j波段的灰度值轉為0~255
Image_b= uint8(InputImage_b);%將k波段的灰度值轉為0~255
RGBImg=cat(3,Image_r,Image_g,Image_b);%將i、j、k三個波段進行合成
figure;
subplot(221);imshow(Image_r);title('紅色波段');
subplot(222);imshow(Image_g);title('綠色波段');
subplot(223);imshow(Image_b);title('藍色波段');
subplot(224);imshow(RGBImg);title('合成波段');
imwrite(Image_r,['TIFBand',num2str(i),'.jpg']);
imwrite(Image_g,['TIFBand',num2str(j),'.jpg']);
imwrite(Image_b,['TIFBand',num2str(k),'.jpg']);
imwrite(RGBImg,'compositeRGBTIFimg.jpg');
4.2.2 運行結果(整合后):
第130波段
|
第160波段
|
第190波段
|
三波段組合
|
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/241324.html
標籤:其他
上一篇:計網計算題
下一篇:ch_2演算法分析

第120波段
第180波段
第220波段
三波段組合
第130波段
第160波段
第190波段
三波段組合