Save hyperspectral image with all the bands

7 views (last 30 days)
Hello!
I have 97 .tiff files, one per band of my hyperspectral camera.
I want to create a single file containing all the bands to then be imported and analysed in ENVI.
I know previous researchers successfully used the command multibandwrite, but somehow it does not work for me. The output actually exists, but there is no information in the file properties (dimensions, width, height, resolution...)
Could you please help me? Here is my code.
Thank you!
%Cube with all the bands of the k-image analysed in the cycle
data = zeros(1010,1010,97);
%Reading using Tiff structure + insert into the cube with k-images and j-bands
for k = 1:13
for j = 1:97
t = Tiff(strcat('Undistorted\Fig_',num2str(k),'\F',num2str(k),'_b',num2str(j),'.tif'),'r');
data(:,:,j) = read(t);
end
%Writing the multiband file
multibandwrite(data, strcat('Undistorted\Fig_',num2str(k),'\Figure',num2str(k),'_full.tif'), 'bsq', 'precision', 'float', 'machfmt', 'ieee-be');
end

Answers (1)

Abhishek Tripathi
Abhishek Tripathi on 26 Dec 2023
The enviwrite function enables you to save the image. To save your hyperspectral data in ENVI format using the enviwrite function, follow these steps:
  1. If you know the wavelengths of all 97 bands, start by creating a hypercube object using the hypercube function.
  2. Once the hypercube object is created, you can proceed to write the image using the enviwrite function.
Download our Image Processing Toolbox™ Hyperspectral Imaging Library MATLAB®
For more info. see the documentation here

Community Treasure Hunt

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

Start Hunting!