Closed BlcaKHat closed 6 years ago
If the .hdr file contains the band information, then there is no way to get the band information without opening it. If you don't have the data file present, you can use envi.read_envi_header
to get a dict of parameters. But opening the data file along with the header (using envi.open
) shouldn't be an issue because it doesn't actually read the data until you access it.
I am loading the image in img. with this. img = envi.open('Dun_Hyperion_Atm_Corr.hdr','Dun_Hyperion_Atm_Corr')
and can view it by this . view = imshow(img,(29,19,9)) but what if i want to see all the bands before view. means, if i could choose the bands present in the img and i can open in RGB or greyscale.
Band information is in the img.bands
attribute. You can select any three bands to view in RGB. If you want a greyscale image (e.g., band 30) you can do this:
view = spy.imshow(img, (30,))
or this:
view = spy.imshow(img.read_band(30))
Thanx for your reply. But is there any way to find all the bands ? I am trying to make a GUI to list all the bands. and then I could select the bands for R,G,B or one band for greyscale. If somehow I get all the bands I could select them in GUI. because user won't know all the bands which will load into GUI.
As I said before, the band information is information is in the img.bands
attribute. So for example, to get all the center wavelengths, you would use img.bands.centers
.
this is giving the wavelengths. can I put it together with band number like this ?.
please write an example as before. please have a look
sorry to disturb. I think i got it . I will ask again if needed. Thanks @tboggs
I want to open the .hdr file but before it i want to open the band list and and option to choose greyscale or RGB. currently, I am opening like this. please help, I am working with Remote sensing guys so i am not getting any help from them.