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-06-09 21:10:48 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cdff2d1685921afcd391b9679c6870d5138b2d4c
cdff2d16
1 parent
0d24e584
Plot histogram without blue mask
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
dominant_colors.py
dominant_colors.py
View file @
cdff2d1
...
...
@@ -6,6 +6,7 @@ from mpl_toolkits.mplot3d import Axes3D
from
skimage
import
io
from
itertools
import
compress
class
DominantColors
:
CLUSTERS
=
None
...
...
@@ -81,8 +82,16 @@ class DominantColors:
chart
=
np
.
zeros
((
50
,
500
,
3
),
np
.
uint8
)
start
=
0
#creating color rectangles
for
i
in
range
(
self
.
CLUSTERS
):
colors
[
i
][
0
]
=
int
(
colors
[
i
][
0
])
colors
[
i
][
1
]
=
int
(
colors
[
i
][
1
])
colors
[
i
][
2
]
=
int
(
colors
[
i
][
2
])
# Blue mask 제거
fil
=
[
colors
[
i
][
2
]
<
250
and
colors
[
i
][
0
]
>
10
for
i
in
range
(
self
.
CLUSTERS
)]
colors
=
list
(
compress
(
colors
,
fil
))
#creating color rectangles
for
i
in
range
(
len
(
colors
)):
end
=
start
+
hist
[
i
]
*
500
#getting rgb values
...
...
@@ -96,17 +105,9 @@ class DominantColors:
start
=
end
#display chart
#plt.figure()
#plt.axis("off")
#plt.imshow(chart)
#plt.show()
for
i
in
range
(
self
.
CLUSTERS
):
colors
[
i
][
0
]
=
int
(
colors
[
i
][
0
])
colors
[
i
][
1
]
=
int
(
colors
[
i
][
1
])
colors
[
i
][
2
]
=
int
(
colors
[
i
][
2
])
# Blue mask 제거
fil
=
[
colors
[
i
][
2
]
<
250
and
colors
[
i
][
0
]
>
10
for
i
in
range
(
self
.
CLUSTERS
)]
colors
=
list
(
compress
(
colors
,
fil
))
plt
.
figure
()
plt
.
axis
(
"off"
)
plt
.
imshow
(
chart
)
plt
.
show
()
return
colors
...
...
Please
register
or
login
to post a comment