www.gusucode.com > 《matlab图像处理与界面编程宝典》秦襄培 编著,每章的MATLAB源代码程序 > 第26章/第26.4.2节中的代码.txt
truecolor = multibandread('paris.lan', [512, 512, 7], 'uint8=>uint8', ...% 读入数据 128, 'bil', 'ieee-le', {'Band','Direct',[3 2 1]}); figure % 新建窗口 imshow(truecolor); % 显示图像 title('Truecolor Composite (Un-enhanced)') % 设置图像标题 text(size(truecolor,2), size(truecolor,1) + 15,... % 设置说明文字 'Image courtesy of Space Imaging, LLC',... 'FontSize', 7, 'HorizontalAlignment', 'right') figure % 新建窗口 imhist(truecolor(:,:,1)) % 图像红色波段直方图 title('Histogram of the Red Band (Band 3)') % 设置图像标题 r = truecolor(:,:,1); % 红色波段 g = truecolor(:,:,2); % 绿色波段 b = truecolor(:,:,3); % 蓝色波段 figure % 新建窗口 plot3(r(:),g(:),b(:),'.') % 三维散点图 grid('on') % 显示网格 xlabel('Red (Band 3)') % x轴标签 ylabel('Green (Band 2)') % y轴标签 zlabel('Blue (Band 1)') % z轴标签 title('Scatterplot of the Visible Bands') % 设置图像标题 stretched_truecolor = imadjust(truecolor,stretchlim(truecolor)); % 图像对比度扩展 figure % 新建窗口 imshow(stretched_truecolor) % 显示处理后的图像 title('Truecolor Composite after Contrast Stretch') % 设置图像标题 figure % 新建窗口 imhist(stretched_truecolor(:,:,1)) % 红色波段直方图 title('Histogram of Red Band (Band 3) after Contrast Stretch')% 设置图像标题 decorrstretched_truecolor = decorrstretch(truecolor, 'Tol', 0.01);% 去相关性 figure % 新建窗口 imshow(decorrstretched_truecolor) % 显示处理后的图像 title('Truecolor Composite after Decorrelation Stretch') % 设置图像标题 r = decorrstretched_truecolor(:,:,1); % 红色波段 g = decorrstretched_truecolor(:,:,2); % 绿色波段 b = decorrstretched_truecolor(:,:,3); % 蓝色波段 figure % 新建窗口 plot3(r(:),g(:),b(:),'.') % 三维散点绘图 grid('on') % 显示网格 xlabel('Red (Band 3)') % x轴标签 ylabel('Green (Band 2)') % y轴标签 zlabel('Blue (Band 1)') % z轴标签 title('Scatterplot of the Visible Bands after Decorrelation Stretch')% 设置图像标题 CIR = multibandread('paris.lan', [512, 512, 7], 'uint8=>uint8', ... 128, 'bil', 'ieee-le', {'Band','Direct',[4 3 2]}); stretched_CIR = decorrstretch(CIR, 'Tol', 0.01); figure % 新建窗口 imshow(stretched_CIR) % 显示处理后的图像 title('CIR after Decorrelation Stretch') % 设置图像标题