56 """Bound images to a range between zero and one.
58 Some images supplied aren't properly bounded with a maximum value of 1.
59 Either the images exceed the bounds of 1, or values are nowhere near 1,
60 implying indeterminate maximum value. This function determines
61 an appropriate maximum either by taking the value supplied in the
62 absMax argument or by scaling the maximum across all channels with the
63 supplied quant variable.
68 Input RGB image array with dimensions (height, width, 3) in RGB order.
73 The remapped image with values clipped to the range [0, 1].
82 if self.
absMax is not None:
85 r_quant = np.quantile(r, 0.95)
86 g_quant = np.quantile(g, 0.95)
87 b_quant = np.quantile(b, 0.95)
88 turnover = np.max((r_quant, g_quant, b_quant))
89 scale = turnover * self.
quant
95 return np.clip(image, 0, 1)