spectralpython / spectral

Python module for hyperspectral image processing
MIT License
563 stars 138 forks source link

view_cube image returns only top image and no other bands #122

Closed npucino closed 3 years ago

npucino commented 3 years ago

When I run view_cube(img, bands=[1, 12, 2]), the returned interactive cube correctly display the top image but misses all the other bands, displaying all white in the z dimension.

image my image details:

`Data Source: 'C:\test_hsi\multi_1_rd_rf_or'

Rows: 860

# Samples:        3600
# Bands:           272
Interleave:        BSQ
Quantization:  32 bits
Data format:   float32`
tboggs commented 3 years ago

That is odd. Can you tell me the min and max data values for the image cube?

Actually, it would be helpful to know the data limits for the top of the cube, as well as the entire cube. So something like this:

x = img.read_bands((1, 12, 2))
print(np.min(x), np.max(x))
x = img.load()
print(np.min(x), np.max(x))
npucino commented 3 years ago

Thanks for the prompt reply. Here is the result: 0.0 1.017753 0.0 1.1102917

npucino commented 3 years ago

SOLVED. image

Sorry it was a banal problem. My image data boundaries were all zeroes. In other words, the image was not cropped to valid data only. By reading only a subset of the cube where the boudaries are all valid, with:

img_sub=img.read_subregion((200,650),(2400,2850))

when running:

view_cube(img_sub, bands=[1, 12, 2])

displayed the z dimension correctly.

Thanks for this package! Nick