资源简介
高光谱图像的读取程序,可以在matlab界面直接调用
代码片段和文件信息
function [varargout] = enviread(varargin)
% ENVIREAD Easily import ENVI raster files (BSQBILBIP) from header info.
% Z = ENVIREAD(FILENAME); Reads an ENVI binary file (BSQBILBIP) into
% an array using the information from the corresponding header
% file FILENAME.hdr. The output array will be of dimensions
% (mnb) where b is the number of bands.
% Z = ENVIREAD(FILENAMEHEADERFILE); Uses the header information in
% headerfile.
% [ZXY] = ENVIREAD(....); Returns the map coordinate vectors for geo-
% registered data.
% [ZXYinfo] = ENVIREAD(....); Returns the header information as a
% structure.
%
% NOTES: -Requires READ_ENVIHDR to read header data.
% -Geo-registration does not currently support rotated images.
%
% Ian M. Howat Applied Physics Lab University of Washington
% ihowat@apl.washington.edu
% Version 1: 11-Jul-2007 15:11:13
%% check for header reader
if exist(‘read_envihdr.m‘‘file‘) == 0
error(‘This function requires READ_ENVIHDR.m‘)
end
%% READ HEADER INFO
% Read Filename
file = varargin{1};
hdrfile = [file‘.hdr‘];
if nargin == 2
hdrfile = varargin{2};
end
% Get image size and map data from header
info = read_envihdr(hdrfile);
%% Make geo-location vectors
if isfield(info.map_info‘mapx‘) && isfield(info.map_info‘mapy‘)
xi = info.map_info.image_coords(1);
yi = info.map_info.image_coords(2);
xm = info.map_info.mapx;
ym = info.map_info.mapy;
%adjust points to corner (1.51.5)
if yi > 1.5
ym = ym + ((yi*info.map_info.dy)-info.map_info.dy);
end
if xi > 1.5
xm = xm - ((xi*info.map_info.dy)-info.map_info.dx)
end
varargout{2} = xm + ((0:info.samples-1).*info.map_info.dx);
varargout{3} = fliplr(ym - ((0:info.lines-1).*info.map_info.dy));
end
%% Set binary format parameters
switch info.byte_order
case {0}
machine = ‘ieee-le‘;
case {1}
machine = ‘ieee-be‘;
otherwise
machine = ‘n‘;
end
switch info.data_type
case {1}
format = ‘int8‘;
case {2}
format= ‘int16‘;
case{3}
format= ‘int32‘;
case {4}
format= ‘float‘;
case {5}
format= ‘double‘;
case {6}
disp(‘>> Sorry Complex (2x32 bits)data currently not supported‘);
disp(‘>> Importing as double-precision instead‘);
format= ‘double‘;
case {9}
error(‘Sorry double-precision complex (2x64 bits) data currently not supported‘);
case {12}
format= ‘uint16‘;
case {13}
format= ‘uint32‘;
case {14}
format= ‘int64‘;
case {15}
format= ‘uint64‘;
otherwise
error([‘File type number: ‘num2str(dtype)‘ not supported‘]);
end
%% Read File
Z = fread(fopen(file)info.samples*info.lines*info.bandsformat0machine); fclose all;
switch lower(info.interleave)
case {‘bsq‘}
Z = reshape(Z[info.samplesinfo.lines
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3556 2007-08-19 10:53 myenviread.m
----------- --------- ---------- ----- ----
3556 1
- 上一篇:有源滤波器在双馈式风力发电机中使用
- 下一篇:完美产生数字地面电视(DTMB)的信源
相关资源
- 基于Matlab的最大熵模糊图像复原算法
- KITTI雷达点云与图像数据融合matlab源码
- matlab 解码 NMEA0183格式GGA数据
- 一个有关飞机的模板匹配的跟踪的m
- 基于MATLAB的电弧模型仿真
- PRI信号分选
- Matlab论文:基于Matlab的二进制数字调
- 802.11协议吞吐量随节点数性能仿真
- matlab图片rgb转yuv,存.yuv文件 播放器
- Duda模式分类Pattern Classification MATLAB 代
- dijkstra算法的matlab实现31274
- 随机路径生成函数matlab
- matlab语音信号处理工具箱
- matlab2013激活文件
- matlab实现游程编码
- 暗通道先验+引导滤波MATLAB代码
- 边缘检测中的canny算法及其matlab实现
- 通过达曼光栅生成点阵的matlab程序.
- MATLAB核函数算法
- 求控制系统的性能指标MptrtsFAI,matl
- matlab 求DTFT
- 逆变器重复控制算法MATLAB仿真
- MATLAB R2014b 许可协议文件
- matlab读取comtrade格式的程序
- 基于Matlab的RC一阶电路仿真
- Las点云数据读取代码
- 雷达回波加天线方向图模拟程序
- MATLAB 2017b 安装文件及其破解文件百度
- Matlab实现音频降噪
- matlab实现导航卫星系统中计算多普勒
评论
共有 条评论