Skip to content

View Image issue #148

Open
Open

Description

@scochrane0316

Hi there,

I'm new to spectral python and have come across unusual behavior when attempting to view a hyperspectral image with imshow. The information from the hdr file looks correct when I load it in, but when I try to view the image it shows up as follows:
Screenshot 2022-11-15 at 2 59 07 PM

Any ideas on what could be the issue here?
Thanks in advance!

Activity

  1. changed the title [-]View Image showing [/-] [+]View Image issue[/+] on Nov 15, 2022
  2. tboggs commented on Nov 16, 2022

    @tboggs
    Member

    My guess is that either the header metadata is wrong or there is just noise in the bands you are viewing. Did you create the header or did it come from some other software?

    I suggest first trying to view some other bands to see if they all look the same. Or you could just view the first principal component, since any "real" (non-noise) data would appear there.

    The fact that you didn't get an error means the size of the file is consistent with the header metadata but maybe the data type is wrong. You could try a few different values and see if it makes a difference. If you post the contents of your header, I might be able to make a suggestion. The "data type" field would be particularly useful.

  3. scochrane0316 commented on Nov 17, 2022

    @scochrane0316
    Author

    Thanks for the response. The header file came directly from the source (company) that the data itself came from. The data definitely shouldn't be just noise - it shows up correctly in other python packages, QGIS, and ENVI.

    I tried out your suggestion of changing the data type, but the set value is correct. I tried changing the interleave, but then the file won't load at all if it's set to 'bil', 'bip', or 'bsq'. Here's a screenshot of the header metadata. Thank you!
    Screenshot 2022-11-16 at 4 51 51 PM

  4. tboggs commented on Nov 21, 2022

    @tboggs
    Member

    I'm not sure but I've never seen an ENVI header with file type set to "TIFF" so that may be the issue. Can you tell me the exact image file size, in bytes?

  5. scochrane0316 commented on Nov 21, 2022

    @scochrane0316
    Author

    The image file size is 655.2 MB

  6. tboggs commented on Nov 21, 2022

    @tboggs
    Member

    I need the exact size, in bytes (not MB).

  7. scochrane0316 commented on Nov 21, 2022

    @scochrane0316
    Author

    655,171,014 bytes

  8. tboggs commented on Nov 21, 2022

    @tboggs
    Member

    It seems as though the ENVI "header" was provided for informational purposes, rather than actually reading image data from ENVI. I have never seen an ENVI file type of "TIFF" and an interleave value of "tiff" does not appear valid (based on any ENVI header file format descriptions I have seen). Furthermore, ENVI data files are supposed to be flat, binary files so according to the header, which indicates 16-bit integer value data (data type = 2), the image file size should be

    2 * 1519 * 1658 * 235 = 1183695940 bytes
    

    So my guess is that you received a self-contained TIFF file and the ENVI header is provided for metadata. If you want to process the data with the spectral module, the easiest way is probably to convert the TIFF file to ENVI format using something like gdal.

  9. scochrane0316 commented on Nov 22, 2022

    @scochrane0316
    Author

    Thank you, this solved the problem once I converted the TIFF file to ENVI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions