clear all
clc
lines=400;%遥感图像的行数
samples=640;%数据的列数
N=6;%波段数
img=fopen('fychinasub.img','rb');
for i=1:N
bi=fread(img,lines*samples,'uint8');%lines*samples为读入数据的个数,读入的方式是先读行再读列
band_cov=reshape(bi,samples,lines);%重置图像的行数和列数
band_cov2=band_cov';
band_uint8=uint8(band_cov2);
tif=imadjust(band_uint8);%调整像素的范围,使其有一定对比度
mkdir('.\','tifbands1')
name=['.\tifbands1\tif',int2str(i),'.tif'];
imwrite(tif,name,'tif');
tilt=['波段',int2str(i)];
subplot(3,2,i),imshow(tif);title(tilt);
end
fclose(img);