RandomColorJitter#

class RandomColorJitter(brightness=0, contrast=0, saturation=0, hue=0, p=0.95)[source]#

Bases: object

Randomly jitter brightness, contrast, saturation, and hue of point colors.

A torchvision-style ColorJitter for 3D point-cloud "color". Each call draws a random order over the four adjustments and, for each enabled one, applies it with probability p using a factor sampled from the range implied by the constructor argument; modifies data_dict["color"] in place. Registered as RandomColorJitter — use this string as the type in a transform=[...] config list.

Parameters:
  • brightness (float or tuple) – Either a non-negative magnitude b giving the factor range [max(0, 1 - b), 1 + b] or an explicit (min, max) pair. 0 disables. Defaults to 0.

  • contrast (float or tuple) – Same convention as brightness for contrast. Defaults to 0.

  • saturation (float or tuple) – Same convention as brightness for saturation. Defaults to 0.

  • hue (float or tuple) – Either a magnitude h (0 <= h <= 0.5) giving the range [-h, h] or an explicit (min, max) within [-0.5, 0.5]. 0 disables. Defaults to 0.

  • p (float) – Per-adjustment probability of application. Defaults to 0.95.

Example

>>> import numpy as np
>>> np.random.seed(0)
>>> data = {"color": np.array([[100., 150., 200.]], dtype="f4")}
>>> RandomColorJitter(brightness=0.4, p=1.0)(data)["color"].round(2)
array([[103.91, 155.86, 207.81]], dtype=float32)  # brightness factor ~1.04 applied
adjust_brightness(color, brightness_factor)[source]#
adjust_contrast(color, contrast_factor)[source]#
adjust_hue(color, hue_factor)[source]#
adjust_saturation(color, saturation_factor)[source]#
static blend(color1, color2, ratio)[source]#
static get_params(brightness, contrast, saturation, hue)[source]#
static hsv2rgb(hsv)[source]#
static rgb2hsv(rgb)[source]#