Converts an image from sRGB to Linear colorspace. We treat each pixel independently (to color channels as well). Args: x: (*,) image in sRGB space. Returns: (*,) converted image
(x: torch.Tensor)
| 912 | |
| 913 | |
| 914 | def srgb_to_linear(x: torch.Tensor): |
| 915 | """ |
| 916 | Converts an image from sRGB to Linear colorspace. |
| 917 | We treat each pixel independently (to color channels as well). |
| 918 | |
| 919 | Args: |
| 920 | x: |
| 921 | (*,) image in sRGB space. |
| 922 | |
| 923 | Returns: |
| 924 | (*,) converted image |
| 925 | """ |
| 926 | limit = 0.04045 |
| 927 | return torch.where(x > limit, torch.pow((x + 0.055) / 1.055, 2.4), x / 12.92) |
nothing calls this directly
no outgoing calls
no test coverage detected