I am processing some dng files from mit-adobe fivek dataset using python's rawpy library. For most of the images the sizes of the numpy array obtained from rawpy and the actual postprocessed images provided by the dataset donot match.
What can be the possible solution to tackle this?
Could you please provide some
Could you please provide some sample file?
-- Alex Tutubalin @LibRaw LLC
RAW file and equivalent TIFF images
Raw file
https://data.csail.mit.edu/graphics/fivek/img/dng/a0001-jmac_DSC1459.dng
TIFF file
https://data.csail.mit.edu/graphics/fivek/img/tiff16_c/a0001-jmac_DSC145...
OK, understood.
OK, understood.
DNG file metatata:
| | 1) ImageWidth = 3040
| | 2) ImageHeight = 2014
| | 21) DefaultCropOrigin = 15 7 (15/1 7/1)
| | 22) DefaultCropSize = 3008 2000 (3008/1 2000/1)
| | 27) ActiveArea = 0 0 2014 3040
By default, LibRaw extracts ActiveArea image (3040x2014)
Suppose we are discussing the latest public version (https://github.com/LibRaw/LibRaw, master branch):
DefaultCrop tags are parsed into imgdata.sizes.raw_inset_crops[0]
This crop can be applied via: LibRaw::adjust_to_raw_inset_crop(1)
BUT:
DefaultCrop top/left in this specific file is odd and will be rounded to nearest even margin, so image will be cropped to 3007x1999 starting at 16,8
There is no way to avoid this in current LibRaw (this change was implemented in LibRaw 0.20)
You may switch to LibRaw pre-0.20 (0.19 or so) with LIBRAW_PROCESSING_USE_DNG_DEFAULT_CROP flag set to params.raw_processing_options
-- Alex Tutubalin @LibRaw LLC