spectralpython / spectral

Python module for hyperspectral image processing
MIT License
571 stars 139 forks source link

Reading 14GB Image #105

Closed deepanshi-s closed 3 years ago

deepanshi-s commented 4 years ago

I have a 14GB envi image along with a header file. I opened it with envi.open function and I am trying to load it as memmap object. But the functions in pysptools do not take memmap object as an input. Is there any other way to load the image without running out of ram?

tboggs commented 4 years ago

I'm not familiar with pysptools so I can't help you there. The spectral module supports memmaps automatically when opening a file and you can explicitly request memmap objects with the SpyFile.open_memmap method. If the pysptools functions you are using do not support memmaps, the only thing I can suggest is to process sub-regions of the image.

prkyprky commented 4 years ago

I think you have 3 option: You can open image with memmap and then convert to numpy (be careful about right data type). Or just open image with envi.open but don't use SpyFile.open_memmap(), use SpyFile.asarray(). I think SpyFile.asarray() read data from HDD and don't load it into memory. Or the third one is read and process only part of data.

tboggs commented 3 years ago

Closing due to lack of activity.