-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_loadmat_generated.py
More file actions
30 lines (27 loc) · 825 Bytes
/
test_loadmat_generated.py
File metadata and controls
30 lines (27 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import torch
import scipy.io as io
import numpy as np
import cv2
import hdf5storage as hdf5
import utils
#spectral = hdf5.loadmat('./ensemble/track1/ARAD_HS_0466.mat')
spectral = hdf5.loadmat('./ensemble/track2/ARAD_HS_0502.mat')
spectral = hdf5.loadmat('./ensemble/track2/ARAD_HS_0490.mat')
choice = 3
print(spectral) # 'cube' is the data; 'band' is the spectral; 'norm_factor'
img = spectral['cube'] # 31 channels (482,512,31)
print(img.shape)
print(img.dtype)
if choice == 1:
a = 'ARAD_HS_0001.mat'
print(a[:12])
if choice == 2:
img = spectral['cube'][:,:,10]
a = (img * 255).astype(np.uint8)
cv2.imshow('1', a)
cv2.waitKey(0)
if choice == 3:
b = cv2.resize(img, (256, 256))
print(b.shape)
cv2.imshow('1', b[:,:,20])
cv2.waitKey(0)