import os

import matplotlib.image as mpi
from scipy.io import savemat

dir_ = "/home/sw/data/Set5/HR"
files = sorted(os.listdir(dir_))
for i, file_name in enumerate(files):
    im = mpi.imread(dir_ + "/" + file_name)
    gm = im[..., 0] * 0.299 + im[..., 1] * 0.587 + im[..., 2] * 0.114
    savemat("./dataset/val/Set5/(%d).mat" % (i + 1), {"temp3": gm})
