MCPcopy Create free account
hub / github.com/apple/ml-pointersect / apply_gamma

Method apply_gamma

pointersect/data/hypersim_dataset.py:353–362  ·  view source on GitHub ↗

apply the scaling and gamma curve. rgb: (h, w, 3)

(rgb: torch.Tensor, gamma: float, scale: float)

Source from the content-addressed store, hash-verified

351
352 @staticmethod
353 def apply_gamma(rgb: torch.Tensor, gamma: float, scale: float) -> torch.Tensor:
354 """apply the scaling and gamma curve.
355 rgb: (h, w, 3)
356 """
357 if scale is None:
358 return rgb
359
360 rgb = (scale * rgb).clamp(min=0) ** gamma
361 rgb = rgb.clamp(min=0, max=1.)
362 return rgb
363
364 def _get_geometry_hdf5_filename(
365 self,

Callers 1

_get_frameMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected