-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_loadmat.py
More file actions
27 lines (24 loc) · 678 Bytes
/
test_loadmat.py
File metadata and controls
27 lines (24 loc) · 678 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
import torch
import scipy.io as io
import numpy as np
import cv2
import utils
spectral = io.loadmat('../NTIRE2020_Train_Spectral/ARAD_HS_0001.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)