multibandwrite a file does it have hdr and raw(bil bip bsq) file?

7 views (last 30 days)
yanjie qi
yanjie qi on 9 Mar 2016
Commented: Guillaume on 8 Sep 2019
I use the example which the multibandwrite function associated, but it was saved as(.bil,.bip and .bsq). I asked to know can them save as the file when it read.Just like a hdr file and a raw file.Is there any other way to save HSI and MSI file?
numBands = 1;
dataDims = [1024 1024 numBands];
data = reshape(uint32(1:(1024 * 1024 * numBands)), dataDims);
for band = 1:numBands
for row = 1:2
for col = 1:2
subsetRows = ((row - 1) * 512 + 1):(row * 512);
subsetCols = ((col - 1) * 512 + 1):(col * 512);
upperLeft = [subsetRows(1), subsetCols(1), band];
multibandwrite(data(subsetRows, subsetCols, band), ...
'banddata.bsq', 'bsq', upperLeft, dataDims);
  1 Comment
Guillaume on 8 Sep 2019
I have no idea what a HSI or MSI file and I really don't understand what you're asking.
Note that with your example code, since there's only one band it doesn't matter which mode you use 'bil', 'bip' and 'bsq' will produce the same file.

Sign in to comment.

Answers (1)

Ruolin on 8 Sep 2019
I guess not. And you have to write another hdr file to make it work. Only by dragging both the hdr and bsq/bil/bip at the same time can the image be shown in ENVI. And here's a coding for building a hdr file:
% building *.hdr file
h2='description = { Binary Data }';
h3=strcat('samples = ',num2str(ncols));
h4=strcat('lines = ',num2str(nrows));
h5=strcat('bands = ',num2str(nbands));
h6='header offset = 0';
h7='file type = ENVI Standard';
h8='data type = 5';
h9='interleave = bil';
h10='sensor type = Unknown';
h11='byte order = 0';
h12='wavelength units = Unknown';
for i=1:12;

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!