Reputation: 13
How do you read into memory a hyperspectral image (3d) using python's enthought canopy distribution?
Upvotes: 0
Views: 3301
Reputation: 21
install Spy package. use ipython terminal.
ipython --pylab
to read to memory and view HSI:
from spectral import*
import numpy as np
var=open_image(r"C:\<give_image_file_location>")
img= var.load() #save as ndarray
np.save(outimg, img) #save image to a binary file in .npy format
imshow(var) #view image in some bands
Upvotes: 0
Reputation: 13733
Installing Spectral Python (Spy) is the best way to go:
C:\Users\Me> pip install spectral
Once you get the module installed, reading a hyperspectral image into memory can be readily accomplished by:
>>> import spectral
>>> img = spectral.open_image(<HSI_filename>)
Upvotes: 3