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-04-05 15:39:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
df244dcea51db0fc825b5b35f76776ebf7123c4d
df244dce
1 parent
ebfea036
Applied DominantColor on left cheek and right eye
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
main.py
main.py
View file @
df244dc
import
cv2
from
detect_face
import
DetectFace
from
dominant_colors
import
DominantColors
# Set paths
image
=
"res/irene.jpg"
predictor
=
"shape_predictor_68_face_landmarks.dat"
# Create an instance
df
=
DetectFace
(
"shape_predictor_68_face_landmarks.dat"
,
image
)
# Create an
DetectFace
instance
df
=
DetectFace
(
predictor
,
image
)
'''
# Try: Extract mouth part
mouth = df.extract_face_part(df.mouth)
cv2.imshow("Mouth", mouth)
cv2.waitKey(0)
'''
# Try: Extract right eye part
r_eye
=
df
.
extract_face_part
(
df
.
right_eye
)
cv2
.
imshow
(
"Right eye"
,
r_eye
)
cv2
.
waitKey
(
0
)
# Try : Extract cheek part
cv2
.
imshow
(
"Left cheek"
,
df
.
cheek_img
[
0
])
cv2
.
waitKey
(
0
)
cv2
.
imshow
(
"Right cheek"
,
df
.
cheek_img
[
1
])
cv2
.
waitKey
(
0
)
# Create an DominantColors instance on left cheek image
clusters
=
5
dc
=
DominantColors
(
df
.
cheek_img
[
0
],
clusters
)
colors
=
dc
.
dominantColors
()
print
(
colors
)
dc
.
plotHistogram
()
# Try : Dominant color on right_eye
clusters
=
6
dc_re
=
DominantColors
(
r_eye
,
clusters
)
colors
=
dc_re
.
dominantColors
()
print
(
colors
)
dc_re
.
plotHistogram
()
...
...
Please
register
or
login
to post a comment