starbucksdolcelatte

First, classify warm/cool and then decide spring/fall or summer/winter

Showing 1 changed file with 39 additions and 7 deletions
......@@ -6,7 +6,7 @@ from getjson import GetJson
import imutils
from colormath.color_objects import LabColor, sRGBColor
from colormath.color_conversions import convert_color
'''
# 이성경(res/lees.jpg) dominant colors by order of histogram
# skin, hair, eye 순서
lsk_rgb = [[222.5, 201.4, 188.9], [138.6, 98.4, 55.0], [159.8, 115.8, 61.7]]
......@@ -18,6 +18,7 @@ for color in lsk_rgb:
getJson = GetJson()
C = getJson.get_standard('res/standard.json')
print(C)
tone_analysis = ToneAnalysis()
......@@ -27,12 +28,26 @@ spring = 0
summer = 1
fall = 2
winter = 3
result_prob = []
for season in range(4):
result_prob.append(format(tone_analysis.probability(lsk_lab, season, C, a),".2f"))
print("이성경")
print("봄 : ", format(tone_analysis.probability(lsk_lab, spring, C, a),".2f"), "%")
print("여름 : ", format(tone_analysis.probability(lsk_lab, summer, C, a),".2f"), "%")
print("가을 : ", format(tone_analysis.probability(lsk_lab, fall, C, a),".2f"), "%")
print("겨울 : ", format(tone_analysis.probability(lsk_lab, winter, C, a),".2f"), "%")
print("봄 : ", result_prob[spring], "%")
print("여름 : ", result_prob[summer], "%")
print("가을 : ", result_prob[fall], "%")
print("겨울 : ", result_prob[winter], "%")
print("******************")
if(tone_analysis.is_warm(lsk_lab)):
if(result_prob[spring] >= result_prob[fall]):
print("봄 웜톤")
else:
print("가을 웜톤")
else:
if(result_prob[summer] >= result_prob[winter]):
print("여름 쿨톤")
else:
print("겨울 웜톤")
'''
# Set paths
image = "res/lees.jpg"
......@@ -54,7 +69,6 @@ l_eye = df.extract_face_part(df.left_eye)
l_cheek = df.cheek_img[0]
r_cheek = df.cheek_img[1]
# Create an DominantColors instance on left cheek image
clusters = 5
lc_dc = DominantColors(l_cheek, clusters)
......@@ -86,7 +100,25 @@ dc_re.plotHistogram()
hair_img = "res/lees_hair.jpg"
img = cv2.imread(hair_img)
resized_img = imutils.resize(img, width = 100)
clusters = 5
clusters = 6
dc_hair = DominantColors(resized_img, clusters)
colors = dc_hair.dominantColors()
print("hair")
dc_hair.plotHistogram()
skin = DominantColors(df.cheek_img[0], clusters = 5)
skin_colors = list(skin.dominantColors()[0])
hair = DominantColors(resized_img, clusters = 6)
hair_colors = list(hair.dominantColors()[0])
eye = DominantColors(l_eye, clusters = 6)
eye_colors = list(eye.dominantColors()[0])
#skin_colors2 = list(skin.plotHistogram())
print("종윤님코드")
print(skin_colors)
print(hair_colors)
print(eye_colors)
print(" ")
print("descending order")
#print(skin_colors2)
print(" ")
'''
......