赞
踩
以下为头文件
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);
以下为子函数:
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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。