Skip to content

Commit

Permalink
Fix Range Error in Unsigned Integer to Floating Point Conversion (#4)
Browse files Browse the repository at this point in the history
Conversion currently produces output [0, 1), but range should be inclusive [0, 1].
  • Loading branch information
nullus authored Aug 11, 2023
1 parent 96030cd commit 0dabcd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rawhdr/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def load_image(path, return_original_dtype=False):
no_auto_bright=True,
use_camera_wb=True,
output_bps=16)
rgb = rgb.astype('float32') / np.float32(2**16)
rgb = rgb.astype('float32') / np.float32(2**16 - 1)
dtype = rgb.dtype
except rawpy._rawpy.LibRawError:
rgb = imageio.imread(path)
Expand Down

0 comments on commit 0dabcd3

Please sign in to comment.