nagejacob / SpatiallyAdaptiveSSID

Spatially Adaptive Self-Supervised Learning for Real-World Image Denoising (CVPR 2023)
GNU General Public License v3.0
80 stars 6 forks source link

about .mat file #2

Closed chensming closed 1 year ago

chensming commented 1 year ago

Hi, I am interested in your nice work. But I don't know how to convert png to .mat (For example, sometimes I want to see what the original image looks like). I would appreciate if you could answer this question.

nagejacob commented 1 year ago

Does the 'original image' means the raw camera output? If so, the png can not revert to 'original image' due to lack of ISP model and parameters. However, the original image of SIDD dataset could be downloaded from their website (http://130.63.97.225/share/sidd_dng/) as DNG files.

chensming commented 1 year ago

Does the 'original image' means the raw camera output? If so, the png can not revert to 'original image' due to lack of ISP model and parameters. However, the original image of SIDD dataset could be downloaded from their website (http://130.63.97.225/share/sidd_dng/) as DNG files.

Oh, I just want to know how to prepare the dataset like these structure: image

nagejacob commented 1 year ago

Please download SIDD Medium Srgb dataset from https://www.eecs.yorku.ca/~kamel/sidd/dataset.php, and download SIDD Validation and Benchmark '.mat' files from https://www.eecs.yorku.ca/~kamel/sidd/benchmark.php.

chensming commented 1 year ago

Thanks! You are so kind! And I would like to visualize the '.mat' files(eg. ValidationNoisyBlocksSrgb.mat), could you give me some suggestion? (I 'm sorry that I am new to this field) ^_^

nagejacob commented 1 year ago

Try this:

import imageio
import numpy as np
import os
import scipy.io as sio

if __name__ == '__main__':
    SIDD_path = '/Users/nagejacob/Documents/datasets/SIDD'
    mat = sio.loadmat(os.path.join(SIDD_path, 'SIDD_Validation/ValidationNoisyBlocksSrgb.mat'))
    noisy_block = mat['ValidationNoisyBlocksSrgb']
    n = noisy_block.shape[0]
    k = noisy_block.shape[1]
    for i in range(n):
        for j in range(k):
            img = noisy_block[i, j]
            print('extracting %d_%d.png' % (i, j))
            imageio.imwrite('%d_%d.png' % (i, j), img)            

And I advice you to search on google first to solve these common problems.

chensming commented 1 year ago

Try this:

import imageio
import numpy as np
import os
import scipy.io as sio

if __name__ == '__main__':
    SIDD_path = '/Users/nagejacob/Documents/datasets/SIDD'
    mat = sio.loadmat(os.path.join(SIDD_path, 'SIDD_Validation/ValidationNoisyBlocksSrgb.mat'))
    noisy_block = mat['ValidationNoisyBlocksSrgb']
    n = noisy_block.shape[0]
    k = noisy_block.shape[1]
    for i in range(n):
        for j in range(k):
            img = noisy_block[i, j]
            print('extracting %d_%d.png' % (i, j))
            imageio.imwrite('%d_%d.png' % (i, j), img)            

And I advice you to search on google first to solve these common problems.

Oh, thanks a lot!