Getting this error in hyperspectral toolbox "Expected Gain values in input header file to be an array with number of elements equal to 301"
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Himanshu Joshi
le 14 Août 2022
Déplacé(e) : Walter Roberson
le 17 Août 2022
I am getting this error when I want to see the hypercube of the data by hyperspectral camera
Error using hypercube
Expected Gain values in input header file to be an array with number of elements equal to
301.
Error in hypercube>fieldValidator (line 1369)
validateattributes(info.(field{No}), type, attr,'hypercube',fieldName);
Error in hypercube>validateMetadata (line 1343)
fieldValidator(info, fields, type, attrs);
Error in hypercube (line 305)
validateMetadata(obj.Metadata);
Error in untitled2 (line 4)
hcube = hypercube('Cropped_Cancer.dat');
The code which I used was
clc
clear
info = enviinfo('Cropped_Cancer.hdr');
hcube = hypercube('Cropped_Cancer.dat');
1 commentaire
Réponse acceptée
Keerthana Ramesh
le 17 Août 2022
Déplacé(e) : Walter Roberson
le 17 Août 2022
Hi,
The issue could be due to format mismatch between Gain values in your header file and expected Gain values. The possible workaround for this issue to be resolved can be by editing the Gain value in the header file.
You can use the command below to open the *.hdr file in the Editor. Check whether the first four characters are 'ENVI' or not. If not, you can modify the file to have first four characters as 'ENVI' and, save it.
>> edit your_file_name.hdr
Then you can add your customized Gain value as:
gain = {1, 2, 3, … 301}
Suppose you have only one gain value, then it should be a 301-by-1 array with the same value. But you must manually set up every value in the header file. Alternatively, you can also write hyperspectral data to ENVI file format using ‘enviwrite’ function if it works for your workflow.
Then you can use the ‘enviinfo’ command to check if the Gain value has been successfully set up.
Please refer to the following documentation about more details:
Thanks,
Keerthana
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Hyperspectral Image Processing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!