temp4.py
3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from getjson import GetJson
from matplotlib import pyplot
from mpl_toolkits.mplot3d import Axes3D
from colormath.color_objects import LabColor, sRGBColor, HSVColor
from colormath.color_conversions import convert_color
LABELS = [0, 1, 2, 3]
COLORS = ['orange', 'green', 'red', 'blue']
COLORS_wc = ['red', 'blue', 'red', 'blue']
seasons = ['spring', 'summer', 'fall', 'winter']
getJson = GetJson()
C = getJson.get_standard('res/standard_bc.json')
for c in C:
print("")
for i in range(4):
print(c[i][0][0])
skin_BC_B_vals = [[season[i][0][0] for i in range(4)] for season in C]
print(skin_BC_B_vals)
skin_BC_C_vals = [[season[i][0][1] for i in range(4)] for season in C]
print(skin_BC_C_vals)
skin_B0C = [[skin_BC_B_vals[i], [0, 0, 0, 0], skin_BC_C_vals[i]] for i in range(4)]
#plotting
fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$Lab_b$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$HVC_C$', fontsize=20)
for label, pix in zip(LABELS, skin_B0C):
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('$Lab_b$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$HVC_C$', fontsize=20)
for label, pix in zip(LABELS, skin_B0C):
print(seasons[label])
print(pix[0])
print(pix[1])
print(pix[2])
ax.scatter(pix[0], pix[1], pix[2], color = COLORS_wc[label])
pyplot.show()
w = [skin_B0C[0], skin_B0C[2]]
c = [skin_B0C[1], skin_B0C[3]]
Lw = [0,2]
Lc = [1,3]
fig = pyplot.figure()
ax = Axes3D(fig)
ax.set_xlabel('$Lab_b$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$HVC_C$', fontsize=20)
for label, pix in zip(Lw, w):
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('$Lab_b$', fontsize=20)
ax.set_ylabel('$0$', fontsize=20)
ax.set_zlabel('$HVC_C$', fontsize=20)
for label, pix in zip(Lc, c):
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()
'''
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()
'''