Closed nmynol closed 2 years ago
Hi, basically the visualization method should depend on your purpose. If you just want to see what the raw data like, I think you can extract the raw array from npz file and normalize it to the range of 0-255, and then save it to the disk as jpg or png file. Or you can do something further like doing white balancing before the normalization. You can follow the procedure in our FiveK_dataset.py file, see this.
Thanks a lot for your helpful advice! I follow your suggestions and use the following codes to save the RAW image like this: and here are the codes:
import rawpy
import numpy as np
import glob, os
import colour_demosaicing
import imageio
import argparse
from PIL import Image as PILImage
import scipy.io as scio
import cv2
path = 'a0002-dgw_005.dng'
raw = rawpy.imread('a0002-dgw_005.dng')
flip_val = raw.sizes.flip
cwb = raw.camera_whitebalance
raw_img = raw.raw_image_visible
print(raw_img.shape) # (2844, 4284)
de_raw = colour_demosaicing.demosaicing_CFA_Bayer_bilinear(raw_img, 'RGGB')
print(de_raw.shape) # (2844, 4284, 3)
de_raw = de_raw / float(16383) * 255.0
cv2.imwrite('out.jpg', de_raw)
But I still have some questions and I wonder if you could give me some advice for it, sorry for my bothering.
de_raw
) with the value of 16383, because I see the codes here using the value of 16383. I would like to know why should it be 16383? Is it because the max possible value of the sensor is 16383? Or it is because the max value ever appeared in the dataset is 16383? Also, I see you also use the white balance parameter to normalize the RAW image in here, may I ask what's the purpose of it?raw_img
before colour_demosaicing, I will get a gray-scale image, is it normal, or I save it incorrectly?Thanks again for your time and advice!
Got it. Thanks a lot for your answers!
Hi! Thanks for the nice work! I notice that in your paper you visualize the RAW image through bilinear demosaicing, but I don't know how I can visualize the RAW image after bilinear demosaicing. in the
data/data_preprocess.py
, the RAW image after bilinear demosaicing ia simply saved in the format of '.npz', and I can't find any code to visualize it. Could you please tell me how I can visualize it? Thank you very much!