Skip to content

Instantly share code, notes, and snippets.

@KelSolaar
Created March 7, 2017 04:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KelSolaar/efe7bcd9ce0daa663280dc97814d83fb to your computer and use it in GitHub Desktop.
Save KelSolaar/efe7bcd9ce0daa663280dc97814d83fb to your computer and use it in GitHub Desktop.
RGB to HSV - Roundtrips
import numpy as np
import colour
RGB_i = [0.325683457522574, 0.094356847568351, 0.745367969845698]
RGB_o = np.ones(3)
for i in range(10000):
RGB_o = colour.HSV_to_RGB(colour.RGB_to_HSV(RGB_i))
np.testing.assert_almost_equal(RGB_i, RGB_o, decimal=15)
print(RGB_o)
# [ 0.32568346 0.09435685 0.74536797]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment