Toggle navigation
Toggle navigation
This project
Loading...
Sign in
조수연
/
Find_your_own_personal_color
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
starbucksdolcelatte
2019-05-23 18:05:18 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7d7094c206be1111e696d2a7aaf2392a218d5335
7d7094c2
1 parent
18fb4d2d
ToneAnalysis Class and GetJson Class Usage guide
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
1 deletions
main.py
main.py
View file @
7d7094c
import
cv2
from
detect_face
import
DetectFace
from
dominant_colors
import
DominantColors
from
tone_analysis
import
ToneAnalysis
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
]]
lsk_lab
=
[]
for
color
in
lsk_rgb
:
rgb
=
sRGBColor
(
color
[
0
],
color
[
1
],
color
[
2
],
is_upscaled
=
True
)
lab
=
convert_color
(
rgb
,
LabColor
,
through_rgb_type
=
sRGBColor
)
lsk_lab
.
append
([
lab
.
lab_l
,
lab
.
lab_a
,
lab
.
lab_b
])
getJson
=
GetJson
()
C
=
getJson
.
get_standard
(
'res/standard.json'
)
tone_analysis
=
ToneAnalysis
()
print
(
"******************"
)
a
=
[
30
,
20
,
10
]
# 가중치
spring
=
0
summer
=
1
fall
=
2
winter
=
3
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
(
"******************"
)
'''
# Set paths
image
=
"res/
fall_0_0.pn
g"
image = "res/
lees.jp
g"
predictor = "shape_predictor_68_face_landmarks.dat"
# Create an DetectFace instance
...
...
@@ -42,3 +74,14 @@ dc_re = DominantColors(r_eye, clusters)
colors = dc_re.dominantColors()
print(colors)
dc_re.plotHistogram()
# hair
hair_img = "res/lees_hair.jpg"
img = cv2.imread(hair_img)
resized_img = imutils.resize(img, width = 100)
clusters = 6
dc_re = DominantColors(resized_img, clusters)
colors = dc_re.dominantColors()
print(colors)
dc_re.plotHistogram()
'''
...
...
Please
register
or
login
to post a comment