ChromaticAutoContrast#
- class ChromaticAutoContrast(p=0.2, blend_factor=None)[source]#
Bases:
objectRandomly auto-contrast the per-point RGB color.
With probability
pand when"color"is present, rescales each RGB channel to span[0, 255](per-channel min/max stretch) and blends the result with the original color byblend_factor; modifiesdata_dict["color"][:, :3]in place. Registered asChromaticAutoContrast— use this string as thetypein atransform=[...]config list.- Parameters:
p (float) – Probability of applying the transform. Defaults to
0.2.blend_factor (float, optional) – Blend weight toward the contrasted color; if
Nonea freshU(0, 1)value is drawn per call. Defaults toNone.
Example
>>> import numpy as np >>> np.random.seed(0) >>> data = {"color": np.array([[50., 100., 150.], ... [100., 150., 200.]], dtype="f4")} >>> ChromaticAutoContrast(p=1.0)(data)["color"].round(2) array([[ 14.24, 28.48, 42.72], [210.85, 225.09, 239.34]], dtype=float32) # stretched toward [0, 255]