MCPcopy Create free account
hub / github.com/HobbitLong/PyContrast / solarize_add

Function solarize_add

pycontrast/datasets/RandAugment.py:129–141  ·  view source on GitHub ↗
(img, add, thresh=128, **__)

Source from the content-addressed store, hash-verified

127
128
129def solarize_add(img, add, thresh=128, **__):
130 lut = []
131 for i in range(256):
132 if i < thresh:
133 lut.append(min(255, i + add))
134 else:
135 lut.append(i)
136 if img.mode in ("L", "RGB"):
137 if img.mode == "RGB" and len(lut) == 256:
138 lut = lut + lut + lut
139 return img.point(lut)
140 else:
141 return img
142
143
144def posterize(img, bits_to_keep, **__):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected