(img, addition=0, threshold=128)
| 152 | |
| 153 | |
| 154 | def SolarizeAdd(img, addition=0, threshold=128): |
| 155 | img_np = np.array(img).astype(np.int) |
| 156 | img_np = img_np + addition |
| 157 | img_np = np.clip(img_np, 0, 255) |
| 158 | img_np = img_np.astype(np.uint8) |
| 159 | img = Image.fromarray(img_np) |
| 160 | return PIL.ImageOps.solarize(img, threshold) |
| 161 | |
| 162 | |
| 163 | def Posterize(img, v): # [4, 8] |