2024-01-15 05:13:30 +00:00
|
|
|
import numpy as np
|
|
|
|
from matplotlib.colors import rgb_to_hsv
|
|
|
|
|
|
|
|
from check import plot_preds
|
|
|
|
from utils import extract_colors
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
rgb_tensor, _ = extract_colors()
|
|
|
|
xkcd_rgb = rgb_tensor.numpy()
|
2024-01-16 03:05:26 +00:00
|
|
|
# xkcd_rgb = np.random.rand(1000, 3)
|
2024-01-15 05:13:30 +00:00
|
|
|
xkcd_hsv = rgb_to_hsv(xkcd_rgb)
|
2024-01-16 03:05:26 +00:00
|
|
|
plot_preds(
|
2024-01-26 03:02:33 +00:00
|
|
|
xkcd_hsv[:, 0], xkcd_rgb, fname="hsv", roll=True, dpi=300, figsize=(6, 6)
|
2024-01-16 03:05:26 +00:00
|
|
|
)
|
2024-01-16 05:19:54 +00:00
|
|
|
rgb = np.vstack([np.eye(3), np.eye(3) + np.eye(3)[:, [1, 2, 0]]])
|
2024-01-15 05:13:30 +00:00
|
|
|
print("Pure RGB in Hue-Space:")
|
2024-01-16 05:19:54 +00:00
|
|
|
print(rgb)
|
2024-01-15 05:13:30 +00:00
|
|
|
print(rgb_to_hsv(rgb)[:, 0])
|