Working with large hyperspectral/multispectral multiband image files in MATLAB
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 2 de Jul. de 2018
Editada: MathWorks Support Team
el 29 de Ag. de 2024
How do I work with a large hyperspectral/multispectral image in MATLAB when the file is too large to store in RAM or MATLAB workspace? For instance a BIL, BIP, or BSQ file that has hundreds or thousands of bands, making the file very large.
Please follow the below link to search for the required information regarding the current release:
Respuesta aceptada
MathWorks Support Team
el 28 de Jul. de 2024
Editada: MathWorks Support Team
el 29 de Ag. de 2024
Here are two suggested options for working with large mulitband images. Both involve loading only a portion of the image into the MATLAB workspace at a time, but each has advantages and disadvantages in terms of computation speed and hard drive space:
1) Operate on the image using subsets of bands
If you do not need all of the bands at once to perform your operations, you can load only a subset of the bands into the workspace at a time. To do this use the "multibandread" function, but specify that you only want a subset of the bands in the input. This would work if many of the bands are irrelevant to your analysis or if the types of operations you are performing allow you to work on the data one subset at a time.
Please run the below command in the command window of installed MATLAB R2019a version to get release specific documentation that describes an example of only reading certain bands with the "multibandread" function:
>> web(fullfile(docroot, 'images/finding-vegetation-in-a-multispectral-image.html'))
Here the "multibandread" function only read bands 4,3, and 2; as specified in the input "{'Band','Direct',[4 3 2]}":
CIR = multibandread('paris.lan', [512, 512, 7], 'uint8=>uint8',...
128, 'bil', 'ieee-le', {'Band','Direct',[4 3 2]});
Please run the below command in the command window of installed MATLAB R2019a version to get release specific documentation for more information on the "multibandread" function:
>> web(fullfile(docroot, 'matlab/ref/multibandread.html'))
2) Split the image into multiple files and use a datastore object
This option is similar to option 1, but use a "datastore" object to deal with the large file. To do this you will first have to read each band of the file one-by-one, using a method similar to that in option 1, then save each band as a grey-scale image somewhere in memory. Then you can load this collection of images into an "imagedatastore" or "datastore" object which can make performing certain operations easier and may be faster due to the prepossessed splitting of the image into bands. This method will be especially faster than option 1 if the "multibandread" function takes a significant amount of time and you want to operate on the image more than once. Note that doing this will take up additional hard drive space nearly equal that of the original file, but this may be a good trade-off for increase speed.
For more information, please run the below commands in the command window of installed MATLAB R2019a version to get release specific documentation on the following topics:
Datastore documentation:
>> web(fullfile(docroot, 'matlab/datastore.html'))
ImageDatastore documentation:
>> web(fullfile(docroot, 'matlab/ref/matlab.io.datastore.imagedatastore.html'))
Example of analyzing a collection of images with datastores:
>> web(fullfile(docroot, 'matlab/import_export/read-and-analyze-image-files.html'))
Please follow the below link to search for the required information regarding the current release:
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!