load_raw#
- deepinv.utils.load_raw(fname, dtype=torch.float32, **kwargs)[source]#
Loads any RAW image file as a torch tensor along with a metadata dictionary.
Reads any proprietary raw files supported by
LibRaw <https://www.libraw.org>usingrawpy(ie.arw,.cr2/.cr3,.nef,.raf,.orf,.rw2,``.pef``,.srw,``.dng``…). Returns the sensor image as a tensor of shape(1, 1, H, W)along with a dict of ISP metadata.Note
Only \(2\times 2\) Bayer sensors are supported for now; non-Bayer CFAs (e.g. X-Trans) will raise an error.
Warning
Requires
rawpyto be installed. Install it withpip install rawpy.- Parameters:
fname (str, pathlib.Path) – path to the raw file.
dtype (torch.dtype) – dtype of the returned tensor.
- Returns:
tuple
(y, meta)whereyis atorch.Tensorof shape(1, 1, H, W)andmetais adictof ISP metadata with keyscfa_pattern,cfa_colors,color_description,num_colors,black_level_per_channel,camera_white_level_per_channel,camera_whitebalance,daylight_whitebalance,color_matrix,rgb_xyz_matrix,tone_curve,raw_shape,visible_shape,crop_margins,pixel_aspect,flipandraw_type.- Return type: