It can't work when converting ICVL HIS dataset to RGB img
Closed this issue · 2 comments
Hi, When I use your code to convert ICVL HSI dataset (31 channels from 400nm to 700nm , step 10nm) to RGB img. The result of this way is Incomprehensible.
First, I replace code in demo,py
## Load data
HSI_path = Path('./washington_hsi.mat')
HSI_mat = spio.loadmat(HSI_path)
HSI_data = HSI_mat['Y']
(ydim, xdim, zdim) = HSI_data.shape
with
## Load data
HSI_path = Path('./ICVL/rmt_0328-1241-1.mat')
HSI_data = np.array(h5py.File(HSI_path, 'r')['rad'])
HSI_data = np.transpose(HSI_data,(1,2,0))
(ydim, xdim, zdim) = HSI_data.shape
to load data form ICVL dataset and change channels order (from (channel width height) to (width height channel))
Then I replace code in demo.py
# Load wavelengths of hyperspectral data
wl = np.squeeze(HSI_mat['wl']).tolist()
with
wl = [i for i in range(400, 710, 10)]
to change wave list.
At last, I run demo,py and the result is Incomprehensible like this
If I use your code in a wrong way, plz tell me what I should do in a right way.
Thks!!!
Hello It is hard to understand exactly what is going wrong since I do not have access to your data. By looking at your result, my guess is that you are not reshaping your data correctly. I suggest the following: 1. Make sure that the method works for you with the Washington HSI. 2. Look at your data after you have reformed it and compare it to the Washington data and make sure that it is in the correct format. Regards, Jakob S.
…
On Fri, Dec 18, 2020 at 7:04 AM Zhuang Chen @.***> wrote: Hi, When I use your code to convert ICVL HSI dataset (31 channels from 400nm to 700nm , step 10nm) to RGB img. The result of this way is Incomprehensible. First, I replace code in demo,py ## Load dataHSI_path = Path('./washington_hsi.mat')HSI_mat = spio.loadmat(HSI_path)HSI_data = HSI_mat['Y'] (ydim, xdim, zdim) = HSI_data.shape with ## Load data HSI_path = Path('./ICVL/rmt_0328-1241-1.mat') HSI_data = np.array(h5py.File(HSI_path, 'r')['rad']) HSI_data = np.transpose(HSI_data,(1,2,0)) (ydim, xdim, zdim) = HSI_data.shape to load data form ICVL dataset and change channels order (from (channel width height) to (width height channel)) Then I replace code in demo.py # Load wavelengths of hyperspectral datawl = np.squeeze(HSI_mat['wl']).tolist() with wl = [i for i in range(400, 710, 10)] to change wave list. At last, I run demo,py and the result is Incomprehensible like this [image: 1] https://user-images.githubusercontent.com/37300440/102584634-c9d82f00-4141-11eb-8851-0f05adff6d6c.png If I use your code in a wrong way, plz tell me what I should do in a right way. Thks!!! — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#2>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOHNWFGRXG5ZHIZ2NFDD34TSVL5F7ANCNFSM4VAYNRKA .
Thank u very much!
Through the MATLAB code, I successfully convert the same HSI data to RGB img and the result is really amazing !
But python code still can't work.
I check the data carefully and make sure the data is right but nothing has changed.
Anyway, your work really help me a lot. Thks!