当前位置:   article > 正文

MATLAB读取高光谱数据

matlab读取高光谱数据

只能读取dat类型的高光谱数据

以下为头文件

clc
clear all
close all
 

hdr = read_envihdr('d.hdr');
Image = multibandread('d.dat', hdr.size, [hdr.format '=>double'], hdr.header_offset, hdr.interleave, hdr.machine);

Image= reshape(Image,hdr.samples*hdr.lines,hdr.bands);

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

以下为子函数:

function info = read_envihdr(hdrfile)
% READ_ENVIHDR read and return ENVI image file header information.
%   INFO = READ_ENVIHDR('HDR_FILE') reads the ASCII ENVI-generated image
%   header file and returns all the information in a structure of
%   parameters. 
%
% Output: 
%  * Info - struct with fields provided in the ENVI file. ENVI header 
%             format requires the following fields:
%    * samples - number of samples in the image (columns)
%    * lines - number of lines in the image (rows)
%    * bands - number of bands in the image. If all 3 dimensions are
%      provided than info.size will be created holding 
%      [info.lines info.samples info.bands]
%    * data_type - data type of the image stored as an integer in 1-15 
%      range. If provided than info.format will be created holding string 
%      with Matlab's type name.  
%    * interleave -  file band interleave type; either bip, bsq, or bil are 
%      possible
%    * byte_order - byte order (0 is little endian [least significant
%       byte first], 1 is big endian [most significant byte first]). 
%      If 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号