letmaik / rawpy

📷 RAW image processing for Python, a wrapper for libraw
https://pypi.python.org/pypi/rawpy
MIT License
587 stars 67 forks source link

Unusual behaviour with `no_auto_bright=True` #149

Closed DuncanM-XR closed 2 years ago

DuncanM-XR commented 3 years ago

I have encountered a weird brightness issue for some of images. Find images here.

If I process the pair of images from CAME****.raf the resulting images (that I save or view with openCV) have the same apparent brightness (which I can confirm looking at histograms of them with matplotlib).

However if I do the same with the pair of images from CAMD****.raf one of the images comes out brighter.

sample code for processing:

import rawpy
path = 'CAM*****.raf'
with rawpy.imread(path) as raw:

    rgb = raw.postprocess(no_auto_bright=True, no_auto_scale=False,gamma=(1, 1), output_bps=16, user_wb=[809.0, 302.0, 374.0, 0.0], use_auto_wb=False, use_camera_wb=False)

If set no_auto_bright=False the problem disappears, but I need to have any auto brightening disabled for processing across lots of images.

Also should mention that I have checked this on multiple cameras and can confirm that the problem doesn't arise when viewing the raw images in another software such as lightroom or google drive (as can be seen in the link).

This maybe could be something specific with the file but I'm not sure.

DuncanM-XR commented 2 years ago

Incase anyone comes across a similair behavious, this is caused the normalisation used when saving the processed RAW data into an image file or array. The behaviour was just dependant on no_auto_bright and not caused by it.