HueSaturationTranslation#
- class HueSaturationTranslation(hue_max=0.5, saturation_max=0.2)[source]#
Bases:
objectRandomly translate hue and scale saturation of point colors.
When
"color"is present, convertsdata_dict["color"][:, :3]to HSV, adds a random hue offset in+/- hue_max(wrapped modulo 1) and multiplies saturation by1 + U(-saturation_max, saturation_max)(clipped to[0, 1]), then converts back to RGB and clips to[0, 255]; modifies the color in place. Registered asHueSaturationTranslation— use this string as thetypein atransform=[...]config list.- Parameters:
hue_max (float) – Half-width of the random hue offset (HSV hue units in
[0, 1]). Defaults to0.5.saturation_max (float) – Half-width of the random saturation scaling factor about 1. Defaults to
0.2.
Example
>>> import numpy as np >>> np.random.seed(0) >>> data = {"color": np.array([[200., 100., 50.]], dtype="f4")} >>> HueSaturationTranslation(hue_max=0.5, saturation_max=0.2)(data)["color"] array([[200., 139., 37.]], dtype=float32) # hue rotated, saturation rescaled