Film grain via random noise blend.
(img: torch.Tensor, strength: float)
| 167 | |
| 168 | |
| 169 | def _apply_grain(img: torch.Tensor, strength: float) -> torch.Tensor: |
| 170 | """Film grain via random noise blend.""" |
| 171 | noise = torch.randn_like(img) * strength * 0.1 |
| 172 | return (img + noise).clamp(0, 1) |
| 173 | |
| 174 | |
| 175 | def _apply_color_temp(img: torch.Tensor, kelvin: float) -> torch.Tensor: |
no outgoing calls