Created
November 9, 2017 15:57
-
-
Save DavidEWarrenPhD/6f80ad640228ee1e659a635498e67314 to your computer and use it in GitHub Desktop.
Dimensions of RGB colorspace in JCH using colorspacious
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import colorspacious | |
import numpy as np | |
rgb = np.zeros((1, 256 ** 3, 3), dtype=np.uint8) | |
r = np.tile(np.arange(256), [256 ** 2]) | |
g = np.tile(np.repeat(np.arange(256), 256), [256]) | |
b = np.repeat(np.arange(256), 256 ** 2) | |
rgb[:, :, 0] = r | |
rgb[:, :, 1] = g | |
rgb[:, :, 2] = b | |
jch = colorspacious.cspace_convert(rgb, 'sRGB255', 'JCh') # Casts to double | |
print('JCH mins:', np.min(jch, axis=(0, 1))) | |
print('JCH maxs:', np.max(jch, axis=(0, 1))) | |
# JCH mins: [ 3.25891324e-22 4.07145763e-24 0.00000000e+00] | |
# JCH maxs: [ 99.99781855 111.3069358 359.99999388] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment