temp3.py 24.4 KB
from matplotlib import pyplot
from mpl_toolkits.mplot3d import Axes3D
import random
from colormath.color_objects import LabColor, sRGBColor, HSVColor
from colormath.color_conversions import convert_color
from sklearn.cluster import KMeans

LABELS = [0, 1, 2, 3]
COLORS = ['orange', 'green', 'red', 'blue']
COLORS_wc = ['red', 'blue', 'red', 'blue']
seasons = ['spring', 'summer', 'fall', 'winter']

#spring, summer, fall, winter
skin_R_vals = [
            [241.0, 233.0, 224.0, 236.0, 237.0, 237.0, 217.0, 214.0, 209.0, 243.0, 238.0, 226.0, 214.0, 211.0, 213.0, 247.0, 239.0, 207.0, 238.0, 236.0, 233.0, 240.0, 247.0, 225.0, 232.0, 227.0, 224.0, 221.0, 221.0, 183.0, 236.0, 232.0, 223.0, 243.0, 239.0, 225.0, 209.0, 214.0, 193.0, 202.0, 163.0, 115.0, 221.0, 226.0, 222.0, 248.0, 239.0, 230.0, 244.0, 237.0, 224.0, 245.0, 234.0, 221.0, 241.0, 238.0, 239.0, 237.0, 223.0, 185.0, 238.0, 230.0, 220.0, 242.0, 242.0, 239.0, 225.0, 217.0, 236.0, 225.0, 215.0, 149.0, 250.0, 247.0, 246.0],
            [230.0, 213.0, 194.0, 220.0, 209.0, 228.0, 198.0, 210.0, 184.0, 223.0, 237.0, 230.0, 223.0, 229.0, 211.0, 234.0, 223.0, 246.0, 212.0, 227.0, 198.0, 242.0, 241.0, 238.0, 223.0, 80.0, 199.0, 232.0, 232.0, 229.0, 200.0, 210.0, 188.0, 231.0, 227.0, 219.0, 232.0, 236.0, 225.0, 198.0, 210.0, 185.0, 223.0, 215.0, 215.0, 237.0, 231.0, 242.0, 254.0, 252.0, 244.0, 245.0, 244.0, 247.0, 219.0, 227.0, 235.0, 237.0, 233.0, 225.0, 228.0, 148.0, 163.0, 239.0, 231.0, 215.0, 214.0, 219.0, 201.0, 231.0, 222.0, 217.0, 251.0, 243.0, 232.0],
            [236.0, 230.0, 242.0, 240.0, 222.0, 192.0, 238.0, 228.0, 214.0, 247.0, 243.0, 240.0, 222.0, 221.0, 226.0, 233.0, 226.0, 219.0, 232.0, 238.0, 210.0, 235.0, 247.0, 217.0, 236.0, 240.0, 234.0, 193.0, 188.0, 192.0, 213.0, 201.0, 220.0, 245.0, 230.0, 210.0, 224.0, 222.0, 220.0, 201.0, 192.0, 177.0, 244.0, 246.0, 235.0, 204.0, 218.0, 186.0, 246.0, 233.0, 79.0, 245.0, 239.0, 229.0, 225.0, 210.0, 171.0, 239.0, 250.0, 254.0, 230.0, 244.0, 208.0, 247.0, 219.0, 178.0, 237.0, 226.0, 210.0, 245.0, 246.0, 245.0, 223.0, 214.0, 232.0],
            [221.0, 226.0, 209.0, 253.0, 249.0, 254.0, 247.0, 240.0, 230.0, 232.0, 225.0, 195.0, 232.0, 235.0, 230.0, 245.0, 241.0, 234.0, 176.0, 191.0, 155.0, 245.0, 246.0, 244.0, 240.0, 241.0, 235.0, 203.0, 207.0, 199.0, 239.0, 251.0, 223.0, 181.0, 202.0, 160.0, 233.0, 237.0, 239.0, 181.0, 171.0, 191.0, 214.0, 190.0, 178.0, 234.0, 241.0, 219.0, 243.0, 241.0, 238.0, 242.0, 233.0, 221.0, 221.0, 228.0, 231.0, 254.0, 253.0, 251.0, 221.0, 214.0, 206.0, 230.0, 231.0, 225.0, 212.0, 210.0, 206.0, 212.0, 220.0, 195.0, 235.0, 231.0, 224.0]
            ]

skin_G_vals = [
            [211.0, 198.0, 182.0, 210.0, 204.0, 196.0, 187.0, 181.0, 176.0, 202.0, 193.0, 179.0, 192.0, 187.0, 184.0, 210.0, 199.0, 171.0, 212.0, 205.0, 197.0, 188.0, 195.0, 175.0, 206.0, 201.0, 196.0, 190.0, 197.0, 186.0, 231.0, 221.0, 211.0, 227.0, 208.0, 184.0, 180.0, 187.0, 164.0, 175.0, 150.0, 75.0, 172.0, 175.0, 175.0, 212.0, 199.0, 188.0, 222.0, 213.0, 198.0, 217.0, 204.0, 189.0, 225.0, 221.0, 227.0, 200.0, 178.0, 142.0, 209.0, 196.0, 183.0, 199.0, 196.0, 194.0, 191.0, 176.0, 208.0, 193.0, 183.0, 110.0, 220.0, 213.0, 204.0],
            [190.0, 173.0, 154.0, 203.0, 190.0, 215.0, 181.0, 188.0, 167.0, 197.0, 216.0, 205.0, 194.0, 205.0, 178.0, 210.0, 198.0, 226.0, 183.0, 201.0, 173.0, 230.0, 225.0, 220.0, 209.0, 69.0, 180.0, 207.0, 211.0, 203.0, 177.0, 187.0, 165.0, 215.0, 209.0, 197.0, 208.0, 215.0, 196.0, 181.0, 188.0, 168.0, 189.0, 185.0, 173.0, 204.0, 200.0, 211.0, 223.0, 213.0, 203.0, 217.0, 209.0, 225.0, 186.0, 197.0, 207.0, 217.0, 208.0, 197.0, 204.0, 113.0, 128.0, 217.0, 202.0, 186.0, 188.0, 199.0, 172.0, 215.0, 199.0, 191.0, 242.0, 230.0, 219.0],
            [215.0, 201.0, 224.0, 211.0, 185.0, 148.0, 210.0, 199.0, 183.0, 227.0, 214.0, 202.0, 184.0, 180.0, 188.0, 196.0, 187.0, 177.0, 202.0, 219.0, 158.0, 192.0, 215.0, 164.0, 203.0, 210.0, 199.0, 150.0, 139.0, 145.0, 186.0, 171.0, 199.0, 210.0, 192.0, 173.0, 172.0, 168.0, 164.0, 177.0, 161.0, 144.0, 203.0, 212.0, 190.0, 154.0, 174.0, 129.0, 197.0, 182.0, 41.0, 189.0, 182.0, 171.0, 187.0, 167.0, 123.0, 186.0, 198.0, 213.0, 197.0, 214.0, 172.0, 212.0, 181.0, 139.0, 209.0, 189.0, 170.0, 208.0, 219.0, 213.0, 190.0, 181.0, 201.0],
            [188.0, 192.0, 177.0, 222.0, 216.0, 224.0, 227.0, 215.0, 202.0, 206.0, 198.0, 169.0, 210.0, 214.0, 206.0, 231.0, 220.0, 208.0, 126.0, 143.0, 106.0, 219.0, 225.0, 211.0, 208.0, 199.0, 194.0, 188.0, 194.0, 178.0, 209.0, 226.0, 193.0, 155.0, 173.0, 137.0, 198.0, 204.0, 211.0, 141.0, 132.0, 152.0, 182.0, 155.0, 144.0, 181.0, 193.0, 159.0, 222.0, 218.0, 211.0, 225.0, 208.0, 192.0, 193.0, 203.0, 213.0, 240.0, 232.0, 225.0, 194.0, 187.0, 178.0, 218.0, 214.0, 210.0, 196.0, 192.0, 187.0, 156.0, 171.0, 146.0, 213.0, 204.0, 196.0]
            ]

skin_B_vals = [
            [193.0, 177.0, 161.0, 194.0, 186.0, 177.0, 186.0, 179.0, 172.0, 202.0, 188.0, 174.0, 165.0, 157.0, 145.0, 194.0, 185.0, 163.0, 210.0, 202.0, 193.0, 176.0, 190.0, 166.0, 198.0, 192.0, 185.0, 173.0, 186.0, 185.0, 226.0, 214.0, 203.0, 218.0, 191.0, 163.0, 166.0, 175.0, 150.0, 167.0, 155.0, 71.0, 164.0, 168.0, 157.0, 215.0, 201.0, 189.0, 201.0, 189.0, 174.0, 215.0, 201.0, 187.0, 217.0, 213.0, 222.0, 187.0, 163.0, 126.0, 211.0, 199.0, 183.0, 191.0, 187.0, 183.0, 174.0, 159.0, 188.0, 183.0, 174.0, 105.0, 215.0, 206.0, 196.0],
            [162.0, 145.0, 125.0, 215.0, 207.0, 229.0, 174.0, 183.0, 160.0, 180.0, 202.0, 189.0, 189.0, 202.0, 173.0, 223.0, 210.0, 243.0, 185.0, 205.0, 174.0, 231.0, 227.0, 220.0, 205.0, 81.0, 175.0, 214.0, 215.0, 209.0, 186.0, 198.0, 170.0, 218.0, 210.0, 198.0, 212.0, 219.0, 198.0, 174.0, 183.0, 161.0, 187.0, 182.0, 177.0, 208.0, 201.0, 215.0, 211.0, 199.0, 188.0, 213.0, 200.0, 222.0, 173.0, 189.0, 202.0, 212.0, 202.0, 189.0, 192.0, 99.0, 113.0, 218.0, 201.0, 180.0, 192.0, 206.0, 176.0, 224.0, 204.0, 195.0, 239.0, 229.0, 216.0],
            [204.0, 190.0, 216.0, 197.0, 166.0, 127.0, 196.0, 181.0, 163.0, 212.0, 194.0, 176.0, 166.0, 158.0, 173.0, 175.0, 165.0, 155.0, 192.0, 210.0, 146.0, 192.0, 214.0, 164.0, 187.0, 195.0, 180.0, 131.0, 117.0, 124.0, 170.0, 153.0, 186.0, 183.0, 163.0, 146.0, 132.0, 128.0, 122.0, 171.0, 152.0, 133.0, 179.0, 195.0, 165.0, 131.0, 155.0, 104.0, 179.0, 162.0, 20.0, 166.0, 156.0, 145.0, 163.0, 143.0, 102.0, 149.0, 164.0, 186.0, 182.0, 205.0, 159.0, 191.0, 160.0, 117.0, 203.0, 178.0, 156.0, 201.0, 213.0, 207.0, 177.0, 167.0, 190.0],
            [189.0, 201.0, 183.0, 204.0, 200.0, 212.0, 221.0, 207.0, 191.0, 193.0, 186.0, 157.0, 212.0, 216.0, 206.0, 237.0, 225.0, 213.0, 110.0, 129.0, 85.0, 217.0, 224.0, 211.0, 202.0, 196.0, 190.0, 213.0, 217.0, 209.0, 210.0, 230.0, 193.0, 145.0, 163.0, 130.0, 175.0, 185.0, 195.0, 122.0, 110.0, 134.0, 186.0, 155.0, 138.0, 160.0, 176.0, 136.0, 221.0, 216.0, 211.0, 230.0, 215.0, 199.0, 187.0, 198.0, 211.0, 248.0, 239.0, 230.0, 183.0, 174.0, 166.0, 221.0, 214.0, 213.0, 193.0, 186.0, 180.0, 137.0, 157.0, 129.0, 207.0, 198.0, 189.0]
            ]


'''
IMAGE = [[skin_R_vals[i], skin_G_vals[i], skin_B_vals[i]] for i in range(4)]
COLORS = ['yellow', 'green', 'red', 'blue']
#plotting
fig = pyplot.figure()
ax = Axes3D(fig)
for label, pix in zip(LABELS, IMAGE):
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS[label])
pyplot.show()
'''

skin_Lab_L_vals = [
                [86.57, 82.32, 77.21, 85.92, 84.35, 82.20, 78.37, 76.44, 74.56, 84.77, 81.81, 76.96, 78.88, 77.18, 76.36, 86.88, 83.29, 72.92, 86.96, 84.87, 82.44, 80.53, 83.19, 75.71, 84.68, 82.87, 81.20, 79.17, 81.21, 75.26, 91.90, 88.79, 85.30, 91.26, 85.62, 77.84, 75.42, 77.84, 69.53, 73.55, 63.31, 36.24, 74.55, 75.86, 75.22, 87.95, 83.66, 79.88, 89.72, 86.64, 81.45, 88.90, 84.43, 79.25, 90.58, 89.25, 91.04, 83.39, 76.18, 62.65, 86.25, 82.07, 77.58, 83.70, 82.89, 82.03, 79.80, 75.02, 85.29, 80.50, 76.90, 50.17, 90.05, 87.88, 85.39],
                [79.76, 73.60, 66.57, 83.36, 78.98, 87.36, 74.89, 77.93, 69.73, 81.25, 87.67, 84.05, 80.71, 84.27, 75.27, 86.46, 82.23, 91.89, 76.90, 83.19, 72.86, 92.24, 90.82, 89.17, 84.84, 30.77, 74.75, 85.32, 86.33, 83.95, 74.36, 78.06, 69.83, 87.32, 85.29, 81.33, 85.52, 87.75, 81.60, 74.89, 77.93, 70.10, 79.43, 77.59, 74.51, 84.87, 83.19, 87.18, 91.03, 88.17, 84.78, 88.85, 86.51, 91.19, 77.99, 81.80, 85.28, 88.15, 85.35, 81.63, 83.70, 50.70, 56.50, 88.47, 83.68, 77.79, 78.50, 82.04, 72.93, 87.47, 82.24, 79.59, 96.10, 92.27, 88.34],
                [87.38, 83.08, 90.39, 86.58, 77.86, 64.90, 86.13, 82.21, 76.56, 91.45, 87.51, 83.92, 77.62, 76.37, 79.13, 81.78, 78.71, 75.37, 83.55, 88.68, 69.63, 81.38, 88.56, 72.22, 84.04, 86.29, 82.72, 65.59, 62.03, 64.09, 77.38, 72.12, 81.62, 86.47, 80.27, 73.33, 74.20, 72.95, 71.67, 74.06, 68.73, 62.50, 84.59, 87.30, 80.30, 67.72, 74.54, 59.10, 83.33, 78.10, 21.20, 81.05, 78.58, 74.72, 78.57, 71.77, 55.87, 79.41, 83.65, 88.07, 81.91, 87.84, 73.17, 87.30, 76.46, 60.97, 85.97, 79.49, 72.79, 86.38, 89.42, 87.73, 79.44, 76.15, 83.26],
                [79.05, 80.79, 75.09, 90.55, 88.65, 91.30, 91.66, 87.79, 83.35, 84.56, 81.81, 71.15, 86.01, 87.35, 84.70, 92.87, 89.54, 85.71, 57.35, 63.60, 49.42, 89.43, 91.16, 87.25, 85.96, 83.72, 81.82, 78.15, 80.10, 75.19, 86.31, 91.96, 80.56, 65.99, 72.95, 58.95, 82.28, 84.33, 86.44, 61.89, 58.31, 65.95, 76.86, 67.09, 62.72, 77.92, 81.83, 70.62, 90.10, 88.83, 86.74, 90.98, 85.68, 80.29, 80.24, 83.59, 86.64, 96.07, 93.81, 91.72, 80.39, 77.81, 74.65, 88.06, 86.97, 85.46, 80.36, 79.01, 77.26, 69.17, 74.05, 64.76, 86.88, 84.10, 81.29]
                ]

skin_Lab_a_vals = [
                [7.67, 9.22, 12.10, 6.52, 8.84, 11.77, 10.52, 11.53, 11.28, 14.45, 15.29, 16.27, 3.56, 3.93, 4.70, 10.52, 12.06, 11.86, 8.69, 10.37, 12.10, 16.97, 17.81, 16.91, 7.78, 7.67, 8.13, 8.40, 6.66, -1.23, 0.82, 2.56, 2.77, 3.95, 8.21, 11.69, 8.21, 7.70, 8.41, 8.44, 5.69, 16.44, 16.74, 17.56, 14.55, 13.01, 14.44, 15.18, 4.24, 4.58, 5.44, 9.35, 10.02, 11.07, 4.12, 4.49, 3.22, 11.08, 14.13, 13.99, 10.42, 12.50, 13.28, 14.02, 15.02, 14.40, 9.51, 12.38, 6.67, 9.78, 10.05, 14.73, 9.55, 10.73, 13.58],
                [10.28, 10.58, 10.84, 8.01, 9.71, 6.93, 4.86, 6.96, 4.95, 6.48, 4.98, 6.19, 9.45, 7.87, 11.10, 10.52, 10.81, 9.74, 10.69, 9.77, 9.18, 4.23, 5.79, 6.16, 4.15, 7.18, 5.93, 9.87, 7.94, 10.08, 9.79, 10.05, 9.22, 6.01, 6.40, 7.89, 9.00, 7.91, 10.55, 4.86, 6.96, 4.94, 11.79, 10.23, 15.89, 12.21, 11.06, 11.43, 8.80, 11.50, 12.22, 9.03, 10.84, 7.03, 9.79, 9.31, 8.96, 6.05, 7.72, 8.58, 6.45, 11.73, 11.24, 7.74, 10.00, 9.38, 9.89, 8.19, 11.16, 7.05, 8.90, 9.86, 2.50, 4.23, 3.93],
                [5.46, 8.45, 4.83, 7.90, 10.43, 13.59, 7.54, 7.42, 8.05, 4.41, 6.98, 9.60, 10.97, 11.62, 11.33, 10.00, 10.75, 12.06, 8.95, 5.04, 17.65, 15.32, 10.93, 19.55, 9.14, 8.12, 9.49, 13.41, 15.71, 14.87, 7.10, 8.11, 5.24, 8.24, 9.35, 9.54, 13.90, 14.81, 15.53, 7.63, 9.97, 10.70, 10.98, 9.26, 12.57, 15.57, 13.29, 18.96, 14.87, 15.66, 15.62, 17.02, 17.20, 17.88, 10.09, 12.38, 15.93, 14.26, 13.95, 10.43, 9.36, 8.99, 11.11, 9.05, 10.60, 11.67, 8.79, 11.53, 12.52, 11.87, 8.34, 10.17, 9.74, 9.70, 9.17],
                [11.92, 13.53, 12.51, 7.92, 9.00, 8.44, 5.83, 7.35, 8.07, 7.01, 7.59, 7.51, 7.96, 7.58, 8.36, 5.76, 8.04, 9.87, 17.26, 16.22, 16.97, 8.63, 7.01, 11.49, 10.23, 14.40, 13.96, 9.88, 8.76, 13.17, 10.61, 9.20, 10.62, 7.98, 8.90, 7.51, 8.94, 8.69, 7.23, 12.42, 11.84, 11.92, 12.12, 12.97, 11.85, 16.32, 14.71, 19.36, 7.03, 7.59, 9.37, 6.64, 9.86, 11.42, 8.94, 7.92, 5.87, 6.07, 8.30, 9.72, 7.78, 7.54, 8.16, 4.62, 5.85, 5.69, 5.09, 5.33, 5.56, 18.37, 15.93, 16.14, 6.62, 8.47, 8.75]
                ]

skin_Lab_b_vals = [
                [12.75, 15.12, 16.41, 11.23, 13.25, 15.00, 4.46, 5.43, 6.49, 5.42, 8.58, 9.05, 16.45, 18.34, 23.67, 12.73, 12.30, 9.03, 4.28, 5.49, 6.74, 13.23, 9.60, 11.61, 7.29, 7.83, 9.15, 12.66, 8.59, 0.13, 3.02, 4.76, 5.43, 6.34, 12.42, 16.22, 10.98, 9.60, 11.20, 7.69, -0.90, 9.34, 10.99, 10.74, 15.76, 3.18, 4.30, 5.17, 13.04, 14.90, 15.38, 4.52, 5.36, 5.23, 5.86, 6.01, 3.89, 11.36, 13.87, 14.80, 2.72, 2.97, 4.98, 9.73, 10.70, 11.59, 13.07, 14.33, 13.51, 9.23, 8.83, 8.84, 6.25, 7.83, 9.53],
                [19.51, 19.89, 20.90, -3.81, -6.08, -5.27, 5.75, 5.37, 5.84, 11.88, 9.52, 11.15, 6.29, 4.54, 6.98, -3.37, -2.76, -5.78, 2.82, 1.35, 2.81, 0.96, 0.98, 2.22, 3.71, -5.45, 5.01, -0.28, 0.66, 0.35, -1.56, -2.55, 0.49, 0.50, 1.75, 2.31, 1.06, 0.66, 2.77, 5.75, 5.37, 5.84, 5.52, 5.48, 3.76, 2.30, 3.53, 2.00, 9.79, 11.98, 12.89, 5.51, 8.99, 4.19, 10.97, 7.91, 6.06, 4.94, 6.15, 7.63, 9.03, 13.10, 13.29, 2.26, 4.24, 6.85, 1.38, -0.95, 1.85, -2.44, 0.45, 1.37, 2.51, 2.06, 3.06],
                [8.04, 9.23, 6.12, 10.63, 14.60, 17.47, 10.50, 12.76, 14.29, 9.78, 13.57, 17.98, 14.26, 16.81, 12.67, 15.43, 16.38, 17.02, 8.86, 6.77, 13.79, 5.79, 4.58, 7.62, 12.26, 11.27, 14.10, 16.21, 19.07, 18.03, 11.65, 13.31, 9.17, 17.92, 19.69, 18.93, 27.90, 28.35, 29.84, 6.22, 8.93, 10.52, 17.39, 12.78, 18.72, 19.33, 15.84, 22.38, 15.65, 17.25, 21.17, 19.38, 21.23, 21.69, 17.25, 18.42, 18.87, 26.09, 24.10, 18.70, 11.84, 8.26, 11.59, 14.90, 15.84, 17.44, 6.54, 10.49, 12.74, 8.28, 6.34, 7.06, 10.92, 11.54, 9.51],
                [3.87, -0.02, 1.24, 12.75, 12.10, 9.65, 5.39, 7.09, 9.09, 9.78, 9.49, 9.67, 1.78, 1.64, 3.05, -1.21, 0.16, 0.84, 16.40, 14.53, 19.68, 4.25, 3.08, 4.25, 7.10, 7.09, 7.49, -10.61, -9.82, -12.89, 3.35, 1.17, 3.92, 8.79, 9.02, 6.96, 16.12, 13.75, 11.48, 15.95, 17.63, 15.01, 2.24, 4.90, 8.02, 18.09, 15.07, 20.81, 3.09, 3.86, 3.43, -0.35, -0.28, 0.28, 6.66, 5.68, 3.22, -2.17, -0.81, 0.81, 9.03, 10.11, 9.84, -0.01, 2.11, 0.38, 3.52, 5.31, 5.98, 18.15, 14.09, 16.21, 5.72, 6.44, 7.14]
                ]

IMAGE_lab = [[skin_Lab_L_vals[i], skin_Lab_a_vals[i], skin_Lab_b_vals[i]] for i in range(4)]


#plotting

print("")
print("")
print("")
fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$Lab_L$', fontsize=20)
ax.set_ylabel('$Lab_a$', fontsize=20)
ax.set_zlabel('$Lab_b$', fontsize=20)
for label, pix in zip(LABELS, IMAGE_lab):
    #pix = [[L values (75)], [a values (75)], [b values (75)]] (for each seosons by for loop)
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS[label])
pyplot.show()

fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$Lab_L$', fontsize=20)
ax.set_ylabel('$Lab_a$', fontsize=20)
ax.set_zlabel('$Lab_b$', fontsize=20)
for label, pix in zip(LABELS, IMAGE_lab):
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS_wc[label])
pyplot.show()

########################
#sRGB 클래스 인스턴스 생성. RGB 값을 넣을 때 is_upscaled=True로 해줘야 함
skin_rgb = [
        [[241.0, 211.0, 193.0], [233.0, 198.0, 177.0], [224.0, 182.0, 161.0], [236.0, 210.0, 194.0], [237.0, 204.0, 186.0], [237.0, 196.0, 177.0], [217.0, 187.0, 186.0], [214.0, 181.0, 179.0], [209.0, 176.0, 172.0], [243.0, 202.0, 202.0], [238.0, 193.0, 188.0], [226.0, 179.0, 174.0], [214.0, 192.0, 165.0], [211.0, 187.0, 157.0], [213.0, 184.0, 145.0], [247.0, 210.0, 194.0], [239.0, 199.0, 185.0], [207.0, 171.0, 163.0], [238.0, 212.0, 210.0], [236.0, 205.0, 202.0], [233.0, 197.0, 193.0], [240.0, 188.0, 176.0], [247.0, 195.0, 190.0], [225.0, 175.0, 166.0], [232.0, 206.0, 198.0], [227.0, 201.0, 192.0], [224.0, 196.0, 185.0], [221.0, 190.0, 173.0], [221.0, 197.0, 186.0], [183.0, 186.0, 185.0], [236.0, 231.0, 226.0], [232.0, 221.0, 214.0], [223.0, 211.0, 203.0], [243.0, 227.0, 218.0], [239.0, 208.0, 191.0], [225.0, 184.0, 163.0], [209.0, 180.0, 166.0], [214.0, 187.0, 175.0], [193.0, 164.0, 150.0], [202.0, 175.0, 167.0], [163.0, 150.0, 155.0], [115.0, 75.0, 71.0], [221.0, 172.0, 164.0], [226.0, 175.0, 168.0], [222.0, 175.0, 157.0], [248.0, 212.0, 215.0], [239.0, 199.0, 201.0], [230.0, 188.0, 189.0], [244.0, 222.0, 201.0], [237.0, 213.0, 189.0], [224.0, 198.0, 174.0], [245.0, 217.0, 215.0], [234.0, 204.0, 201.0], [221.0, 189.0, 187.0], [241.0, 225.0, 217.0], [238.0, 221.0, 213.0], [239.0, 227.0, 222.0], [237.0, 200.0, 187.0], [223.0, 178.0, 163.0], [185.0, 142.0, 126.0], [238.0, 209.0, 211.0], [230.0, 196.0, 199.0], [220.0, 183.0, 183.0], [242.0, 199.0, 191.0], [242.0, 196.0, 187.0], [239.0, 194.0, 183.0], [225.0, 191.0, 174.0], [217.0, 176.0, 159.0], [236.0, 208.0, 188.0], [225.0, 193.0, 183.0], [215.0, 183.0, 174.0], [149.0, 110.0, 105.0], [250.0, 220.0, 215.0], [247.0, 213.0, 206.0], [246.0, 204.0, 196.0]],
        [[230.0, 190.0, 162.0], [213.0, 173.0, 145.0], [194.0, 154.0, 125.0], [220.0, 203.0, 215.0], [209.0, 190.0, 207.0], [228.0, 215.0, 229.0], [198.0, 181.0, 174.0], [210.0, 188.0, 183.0], [184.0, 167.0, 160.0], [223.0, 197.0, 180.0], [237.0, 216.0, 202.0], [230.0, 205.0, 189.0], [223.0, 194.0, 189.0], [229.0, 205.0, 202.0], [211.0, 178.0, 173.0], [234.0, 210.0, 223.0], [223.0, 198.0, 210.0], [246.0, 226.0, 243.0], [212.0, 183.0, 185.0], [227.0, 201.0, 205.0], [198.0, 173.0, 174.0], [242.0, 230.0, 231.0], [241.0, 225.0, 227.0], [238.0, 220.0, 220.0], [223.0, 209.0, 205.0], [80.0, 69.0, 81.0], [199.0, 180.0, 175.0], [232.0, 207.0, 214.0], [232.0, 211.0, 215.0], [229.0, 203.0, 209.0], [200.0, 177.0, 186.0], [210.0, 187.0, 198.0], [188.0, 165.0, 170.0], [231.0, 215.0, 218.0], [227.0, 209.0, 210.0], [219.0, 197.0, 198.0], [232.0, 208.0, 212.0], [236.0, 215.0, 219.0], [225.0, 196.0, 198.0], [198.0, 181.0, 174.0], [210.0, 188.0, 183.0], [185.0, 168.0, 161.0], [223.0, 189.0, 187.0], [215.0, 185.0, 182.0], [215.0, 173.0, 177.0], [237.0, 204.0, 208.0], [231.0, 200.0, 201.0], [242.0, 211.0, 215.0], [254.0, 223.0, 211.0], [252.0, 213.0, 199.0], [244.0, 203.0, 188.0], [245.0, 217.0, 213.0], [244.0, 209.0, 200.0], [247.0, 225.0, 222.0], [219.0, 186.0, 173.0], [227.0, 197.0, 189.0], [235.0, 207.0, 202.0], [237.0, 217.0, 212.0], [233.0, 208.0, 202.0], [225.0, 197.0, 189.0], [228.0, 204.0, 192.0], [148.0, 113.0, 99.0], [163.0, 128.0, 113.0], [239.0, 217.0, 218.0], [231.0, 202.0, 201.0], [215.0, 186.0, 180.0], [214.0, 188.0, 192.0], [219.0, 199.0, 206.0], [201.0, 172.0, 176.0], [231.0, 215.0, 224.0], [222.0, 199.0, 204.0], [217.0, 191.0, 195.0], [251.0, 242.0, 239.0], [243.0, 230.0, 229.0], [232.0, 219.0, 216.0]],
        [[236.0, 215.0, 204.0], [230.0, 201.0, 190.0], [242.0, 224.0, 216.0], [240.0, 211.0, 197.0], [222.0, 185.0, 166.0], [192.0, 148.0, 127.0], [238.0, 210.0, 196.0], [228.0, 199.0, 181.0], [214.0, 183.0, 163.0], [247.0, 227.0, 212.0], [243.0, 214.0, 194.0], [240.0, 202.0, 176.0], [222.0, 184.0, 166.0], [221.0, 180.0, 158.0], [226.0, 188.0, 173.0], [233.0, 196.0, 175.0], [226.0, 187.0, 165.0], [219.0, 177.0, 155.0], [232.0, 202.0, 192.0], [238.0, 219.0, 210.0], [210.0, 158.0, 146.0], [235.0, 192.0, 192.0], [247.0, 215.0, 214.0], [217.0, 164.0, 164.0], [236.0, 203.0, 187.0], [240.0, 210.0, 195.0], [234.0, 199.0, 180.0], [193.0, 150.0, 131.0], [188.0, 139.0, 117.0], [192.0, 145.0, 124.0], [213.0, 186.0, 170.0], [201.0, 171.0, 153.0], [220.0, 199.0, 186.0], [245.0, 210.0, 183.0], [230.0, 192.0, 163.0], [210.0, 173.0, 146.0], [224.0, 172.0, 132.0], [222.0, 168.0, 128.0], [220.0, 164.0, 122.0], [201.0, 177.0, 171.0], [192.0, 161.0, 152.0], [177.0, 144.0, 133.0], [244.0, 203.0, 179.0], [246.0, 212.0, 195.0], [235.0, 190.0, 165.0], [204.0, 154.0, 131.0], [218.0, 174.0, 155.0], [186.0, 129.0, 104.0], [246.0, 197.0, 179.0], [233.0, 182.0, 162.0], [79.0, 41.0, 20.0], [245.0, 189.0, 166.0], [239.0, 182.0, 156.0], [229.0, 171.0, 145.0], [225.0, 187.0, 163.0], [210.0, 167.0, 143.0], [171.0, 123.0, 102.0], [239.0, 186.0, 149.0], [250.0, 198.0, 164.0], [254.0, 213.0, 186.0], [230.0, 197.0, 182.0], [244.0, 214.0, 205.0], [208.0, 172.0, 159.0], [247.0, 212.0, 191.0], [219.0, 181.0, 160.0], [178.0, 139.0, 117.0], [237.0, 209.0, 203.0], [226.0, 189.0, 178.0], [210.0, 170.0, 156.0], [245.0, 208.0, 201.0], [246.0, 219.0, 213.0], [245.0, 213.0, 207.0], [223.0, 190.0, 177.0], [214.0, 181.0, 167.0], [232.0, 201.0, 190.0]],
        [[221.0, 188.0, 189.0], [226.0, 192.0, 201.0], [209.0, 177.0, 183.0], [253.0, 222.0, 204.0], [249.0, 216.0, 200.0], [254.0, 224.0, 212.0], [247.0, 227.0, 221.0], [240.0, 215.0, 207.0], [230.0, 202.0, 191.0], [232.0, 206.0, 193.0], [225.0, 198.0, 186.0], [195.0, 169.0, 157.0], [232.0, 210.0, 212.0], [235.0, 214.0, 216.0], [230.0, 206.0, 206.0], [245.0, 231.0, 237.0], [241.0, 220.0, 225.0], [234.0, 208.0, 213.0], [176.0, 126.0, 110.0], [191.0, 143.0, 129.0], [155.0, 106.0, 85.0], [245.0, 219.0, 217.0], [246.0, 225.0, 224.0], [244.0, 211.0, 211.0], [240.0, 208.0, 202.0], [241.0, 199.0, 196.0], [235.0, 194.0, 190.0], [203.0, 188.0, 213.0], [207.0, 194.0, 217.0], [199.0, 178.0, 209.0], [239.0, 209.0, 210.0], [251.0, 226.0, 230.0], [223.0, 193.0, 193.0], [181.0, 155.0, 145.0], [202.0, 173.0, 163.0], [160.0, 137.0, 130.0], [233.0, 198.0, 175.0], [237.0, 204.0, 185.0], [239.0, 211.0, 195.0], [181.0, 141.0, 122.0], [171.0, 132.0, 110.0], [191.0, 152.0, 134.0], [214.0, 182.0, 186.0], [190.0, 155.0, 155.0], [178.0, 144.0, 138.0], [234.0, 181.0, 160.0], [241.0, 193.0, 176.0], [219.0, 159.0, 136.0], [243.0, 222.0, 221.0], [241.0, 218.0, 216.0], [238.0, 211.0, 211.0], [242.0, 225.0, 230.0], [233.0, 208.0, 215.0], [221.0, 192.0, 199.0], [221.0, 193.0, 187.0], [228.0, 203.0, 198.0], [231.0, 213.0, 211.0], [254.0, 240.0, 248.0], [253.0, 232.0, 239.0], [251.0, 225.0, 230.0], [221.0, 194.0, 183.0], [214.0, 187.0, 174.0], [206.0, 178.0, 166.0], [230.0, 218.0, 221.0], [231.0, 214.0, 214.0], [225.0, 210.0, 213.0], [212.0, 196.0, 193.0], [210.0, 192.0, 186.0], [206.0, 187.0, 180.0], [212.0, 156.0, 137.0], [220.0, 171.0, 157.0], [195.0, 146.0, 129.0], [235.0, 213.0, 207.0], [231.0, 204.0, 198.0], [224.0, 196.0, 189.0]]
]

skin_hsv_spr = [convert_color(sRGBColor(rgb[0],rgb[1],rgb[2]), HSVColor, through_rgb_type=sRGBColor) for rgb in skin_rgb[0]]
skin_hsv_smr = [convert_color(sRGBColor(rgb[0],rgb[1],rgb[2]), HSVColor, through_rgb_type=sRGBColor) for rgb in skin_rgb[1]]
skin_hsv_fal = [convert_color(sRGBColor(rgb[0],rgb[1],rgb[2]), HSVColor, through_rgb_type=sRGBColor) for rgb in skin_rgb[2]]
skin_hsv_wnt = [convert_color(sRGBColor(rgb[0],rgb[1],rgb[2]), HSVColor, through_rgb_type=sRGBColor) for rgb in skin_rgb[3]]

skin_HSV_h_vals = [[float(hsv.hsv_h) for hsv in skin_hsv_spr], [float(hsv.hsv_h) for hsv in skin_hsv_smr], [float(hsv.hsv_h) for hsv in skin_hsv_fal], [float(hsv.hsv_h) for hsv in skin_hsv_wnt]]
skin_HSV_s_vals = [[float(hsv.hsv_s) for hsv in skin_hsv_spr], [float(hsv.hsv_s) for hsv in skin_hsv_smr], [float(hsv.hsv_s) for hsv in skin_hsv_fal], [float(hsv.hsv_s) for hsv in skin_hsv_wnt]]
skin_HSV_v_vals = [[float(hsv.hsv_v) for hsv in skin_hsv_spr], [float(hsv.hsv_v) for hsv in skin_hsv_smr], [float(hsv.hsv_v) for hsv in skin_hsv_fal], [float(hsv.hsv_v) for hsv in skin_hsv_wnt]]

IMAGE_hsv = [[skin_HSV_h_vals[i], skin_HSV_s_vals[i], skin_HSV_v_vals[i]] for i in range(4)]


#plotting

fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$HSV_H$', fontsize=20)
ax.set_ylabel('$HSV_S$', fontsize=20)
ax.set_zlabel('$HSV_V$', fontsize=20)
for label, pix in zip(LABELS, IMAGE_hsv):
    print(seasons[label])
    print(pix[0])
    print(pix[1])
    print(pix[2])
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS[label])
pyplot.show()


fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$HSV_H$', fontsize=20)
ax.set_ylabel('$HSV_S$', fontsize=20)
ax.set_zlabel('$HSV_V$', fontsize=20)
for label, pix in zip(LABELS, IMAGE_hsv):
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS_wc[label])
pyplot.show()




IMAGE_sb = [[skin_HSV_s_vals[i], [0 for _ in range(75)], skin_Lab_b_vals[i]] for i in range(4)]
fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$HSV_S$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$Lab_b$', fontsize=20)

for label, pix in zip(LABELS, IMAGE_sb):
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS[label])
pyplot.show()


fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$HSV_S$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$Lab_b$', fontsize=20)

for label, pix in zip(LABELS, IMAGE_sb):
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS_wc[label])
pyplot.show()




sb_for_kmeans = [[[skin_HSV_s_vals[i][j], 0, skin_Lab_b_vals[i][j]] for j in range(75)] for i in range(4)]
kmeans = KMeans(n_clusters = 6)
kmeans_sb = []
for i in range(4):
    print(seasons[i])
    kmeans.fit(sb_for_kmeans[i])
    #the cluster centers are our dominant colors.
    sb_COLORS = kmeans.cluster_centers_
    #save labels
    sb_LABELS = kmeans.labels_
    kmeans_sb.append(sb_COLORS)
    print(sb_COLORS)

kmeans_s0b = [[[k[j][0] for j in range(6)], [0 for _ in range(6)], [k[j][2] for j in range(6)]] for k in kmeans_sb]

fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$HSV_S$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$Lab_b$', fontsize=20)
for label, pix in zip(LABELS, kmeans_s0b):
    print(pix[0], pix[1], pix[2])
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS[label])
pyplot.show()

fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$HSV_S$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$Lab_b$', fontsize=20)
for label, pix in zip(LABELS, kmeans_s0b):
    print(pix[0], pix[1], pix[2])
    ax.scatter(pix[0], pix[1], pix[2], color = COLORS_wc[label])
pyplot.show()