how to save hyperspectral image array to image in matlab?
8 次查看(过去 30 天)
显示 更早的评论
hello everyone, i have some questions about processing hyperspectral image using matlab,and they are as follows:
(1) i use multibandread function to read one hyperspectral image and an image array is obtained. Then how can i write the array to image, such "tif","jpg" ? Because hyperspectral image has many bands, so imwrite function is useless. multibandwrite function can be used to write the array, however the result is binary image not tif or jpg.
(2) i randomly select 3 bands from the hyperspectral image array and want to display one color image. I have done this work according to the strategy in rgb image, but the composite rgb hyperspectral image cannot display. what's wrong?
2 个评论
Walter Roberson
2014-3-26
If you had (say) 4 bands, what would you expect the image file to look like? You wold expect that in such a case it would render as CMYK ?
回答(3 个)
Image Analyst
2014-3-26
You can save the variable with save() into a .mat file if all you want to do with it in the future is to read it back into MATLAB again. Of you can use multibandwrite()
Walter Roberson
2014-3-26
When you use imwrite() the expectation is that you are creating an image intended to be rendered for human eyes -- black and white, or greyscale, or pseudocolor, or true color (RGB) or CYMK. imwrite() is not intended for storing multiple bands.
.jpg files cannot store more than 3 bands.
.tiff files can store 4 bands fairly directly and will believe that it is a CMYK image.
If you use the TIFF class then you can create "tiles" and "strips". It also supports a "directory" and "subdirectories" that can be used to write multiple images or data sets to a TIFF file.
2 个评论
Jurgen
2014-3-27
Actually TIFF can store your hyperspectral image as one file. Just don't expect to open it in standard windows image viewer.
Cong Huynh
2015-8-14
To load and save multispectral images (consisting of pairs of .hdr and .fla files), you could use the Scyllarus hyperspectral image processing toolbox. The MATLAB version of this toolbox is available for non-commercial use and can be downloaded from http://scyllarus.research.nicta.com.au/
The functions to look at are FLARead and FLAWrite under src/io. With these functions you can read from and write to the .fla format (ENVI-compatible), rather than any colour image format. Alternatively you can save the image to a .mat file but this option usually produces a much larger image.
1 个评论
yanjie qi
2016-3-9
I have tried the tool box,and I use matlab R2014a. However, most of the function I can't use them, like FLAread... and
>> G = data2graph(xdata); 未定义与 'double' 类型的输入参数相对应的函数 'data2graph'。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!