MATLAB Answers

How to make an ENVI header file."?

11 ビュー (過去 30 日間)
Mohamed Yasser
Mohamed Yasser 2021 年 6 月 18 日
回答済み: Subhadeep Koley 2021 年 6 月 21 日
I am trying to use the hypercube function to read a hyperspectral image but it gives me this error.
The error
Error using enviinfo (line 86)
Input file must be a ENVI header file.
The code Line:-
hcube = hypercube('indian_pines.dat');
so can you please tell me how to fix it or tell me how can I make it an ENVI header file?
Thank youuu
  1 件のコメント
dpb
dpb 2021 年 6 月 19 日
Certainly from the filename you've used above, it wouldn't appear the file you have is anything but a text data file; why would you think it something else?
Where did the file come from; consult with that source for what the format is.

サインインしてコメントする。

回答 (1 件)

Subhadeep Koley
Subhadeep Koley 2021 年 6 月 21 日
Looks like the indian_pines.hdr ENVI header file has been modified in your system. For a valid ENVI header file, the first four characters must be 'ENVI'.
Use the command below to open the indian-pines.hdr file in the Editor. Then, 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 indian_pines.hdr
Then try reading the hyperspectral data with,
hcube = hypercube('indian_pines.dat');

Community Treasure Hunt

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

Start Hunting!

Translated by