Loading hyperspectral images in Octave

帅比萌擦擦* 提交于 2019-12-23 02:48:31

问题


Using Matlab I can see the 4th channel of my image, but not with Octave:

the following Matlab code for image (I) gives

I =imread('../rec3/2012R_1_1.tif') [nr nc nb] = size(I);
nb

It gives out :

nb = 4

where nb is the channel number and I is a 64 bit image(3057x1210)

But for the same image Octave gives :

nb = 3

Should I load any special package in order to be able to work with hyperspectral images?

EDIT

The output of the imfinfo for Octave:

ans =

scalar structure containing the fields:

Filename = c:/2012R_1_1.tif
FileModDate = 10-May-2016 20:02:10
FileSize =  23140500
Format = TIFF
FormatVersion =
Width =  3057
Height =  1210
BitDepth =  16
ColorType = truecolor
DelayTime = 0
DisposalMethod =
LoopCount = 0
ByteOrder = undefined
Gamma = 0
Chromaticities = [](1x0)
Comment =
Quality =  75
Compression = undefined
Colormap = [](0x0)
Orientation =  1
ResolutionUnit = Inch
XResolution = 0
YResolution = 0
Software =
Make =
Model =
DateTime =
ImageDescription =
Artist =
Copyright =

and for Matlab

Filename: 'c:\2012R_...'
              FileModDate: '10-máj.-2016 18:02:10'
                 FileSize: 23140500
                   Format: 'tif'
            FormatVersion: []
                    Width: 3057
                   Height: 1210
                 BitDepth: 64
                ColorType: 'truecolor'
          FormatSignature: [73 73 42 0]
                ByteOrder: 'little-endian'
           NewSubFileType: 0
            BitsPerSample: [16 16 16 16]
              Compression: 'LZW'
PhotometricInterpretation: 'RGB'
             StripOffsets: [1x38 double]
          SamplesPerPixel: 4
             RowsPerStrip: 32
          StripByteCounts: [1x38 double]
              XResolution: []
              YResolution: []
           ResolutionUnit: 'Inch'
                 Colormap: []
      PlanarConfiguration: 'Chunky'
                TileWidth: []
               TileLength: []
              TileOffsets: []
           TileByteCounts: []
              Orientation: 1
                FillOrder: 1
         GrayResponseUnit: 0.0100
           MaxSampleValue: [65535 65535 65535 65535]
           MinSampleValue: [0 0 0 0]
             Thresholding: 1
                   Offset: 23139726
                Predictor: 'Horizontal differencing'
             ExtraSamples: 0
             SampleFormat: {'Unsigned integer'  'Unsigned integer'  'Unsigned integer'  'Unsigned integer'}
       ModelPixelScaleTag: [1 1 1]
         ModelTiepointTag: [0 0 0 6.7143e+05 5.1757e+06 0]
       GeoKeyDirectoryTag: [1x52 double]
       GeoDoubleParamsTag: []
        GeoAsciiParamsTag: ''

回答1:


You can use the functions rasterread or gdalread from the mapping package to read hyperspectral images.

pkg load mapping
ras = rasterread("myfile.tif");
I = ras.data;

or

[~,~,I]= gdalread("myfile.tif");


来源:https://stackoverflow.com/questions/45232456/loading-hyperspectral-images-in-octave

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!