Effacer les filtres
Effacer les filtres

Error using hypercube>​findActual​ImgFileNam​e

10 vues (au cours des 30 derniers jours)
Ananas
Ananas le 14 Déc 2021
Modifié(e) : Ananas le 15 Déc 2021
I'm getting "Error using hypercube>findActualImgFileName (line 1320)" when trying to load a hyperspectral image with the hypercube function. I've opened other .hdr files before with Matlab using the hypercube function without any problems. Any ideas on what is causing the hypercube>findActualImgFileName error? I guess finding the .hdr file with the given name is not a problem, but there's something in the metadata that can't be located? There are no issues when trying to open the .hdr file with ReSe GLIMPS.
As seen in the screenshot I checked that a normal .jpg image can be found in the current folder, and also tested the hypercube with the 'indian_pines.dat' image that comes with Matlab to check if the hypercube is working as it should. No errors so far. Then in the third section I try to load my own hyperspectral image and that's when I get an error about finding the actual image file name.

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Déc 2021
Modifié(e) : Walter Roberson le 14 Déc 2021
"Read ENVI format data into the workspace by specifying a header file that contains information about hyperspectral data. The associated ENVI binary data file must be stored in the same folder as the ENVI header file."
and see https://www.mathworks.com/help/images/ref/hypercube.html#d123e305031 which indicates that it expects a .dat file or .L1R file when you use a .hdr file.
I seem to recall that .hdr files have the name of the corresponding image data stored inside them, so I suspect the file extension is not completely important. However, I suspect that the .hdr file is saying that the image data is stored in a file that has the same name but no extension at all. In particular, I do not think the .hdr file is referring the the .hyspex file.
  4 commentaires
Ananas
Ananas le 14 Déc 2021
It works when using two arguments, thank you:)
Curiously enough it only works when I switch places for the arguments. Meaning hypercube("hyspex-file", "hdr-file") gives an error, but hypercube("hdr-file", "hyspex-file") runs.
if I try
hcube = hypercube("A1_VNIR_1800_SN00841_15000us_2021-07-12T140630_raw.hyspex", "A1_VNIR_1800_SN00841_15000us_2021-07-12T140630_raw.hdr");
I get:
Error using hypercube (line 400)
Input file format must be ENVI, TIFF, or NITF.
Error in tests (line 13)
hcube = hypercube("A1_VNIR_1800_SN00841_15000us_2021-07-12T140630_raw.hyspex",
"A1_VNIR_1800_SN00841_15000us_2021-07-12T140630_raw.hdr");
but when I try
hcube = hypercube("A1_VNIR_1800_SN00841_15000us_2021-07-12T140630_raw.hdr", "A1_VNIR_1800_SN00841_15000us_2021-07-12T140630_raw.hyspex");
There's no error and I'm able to use hyperspectralViewer(hcube) and view the image.
Walter Roberson
Walter Roberson le 15 Déc 2021
Interestingly, there is specific code in hypercube() to detect if the parameter order has been reversed by the user by checking the first parameter for ".hdr". I did not happen to check whether that was done before or after the file format was checked.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by