First import the relevant packages
import scipy.io as sioimport osfilepath = os.path.join('../Denoising/Datasets/test/', 'ValidationNoisyBlocksRaw.mat')print(filepath)##Import mat fileimg=sio.loadmat(filepath)
The return of importing the mat file is a dictionary object.
# print(type(img))for i in img.keys():print(i)
Output results
__header__
__version__
__globals__
ValidationNoisyBlocksRaw
aa=img['ValidationNoisyBlocksRaw']print(type(aa))print(aa.shape)b=aa[0,1,:,:]print(b.shape)print(type(b))
Output
(40, 32, 256, 256)
(256, 256)
from matplotlib import pyplot as pltplt.imshow(b)print(b)plt.show()