multibandwrite a file does it have hdr and raw(bil bip bsq) file?
1 view (last 30 days)
Show older comments
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);
end
end
end
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.
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
h1='ENVI';
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';
h={};
h={h1;h2;h3;h4;h5;h6;h7;h8;h9;h10;h11;h12};
fid=fopen(‘writebil.hdr’,'wt');
for i=1:12;
fprintf(fid,'%s\n',h{i});
end
fclose(fid)
0 Comments
See Also
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!