Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
skin_detector
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
人工智能
skin_detector
Commits
359f84d3
Commit
359f84d3
authored
May 16, 2019
by
吴升宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wsy fix
parent
4258b130
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
2 deletions
+74
-2
.gitignore
.gitignore
+5
-2
add_image.py
add_image.py
+57
-0
test_image.png
input/test_image.png
+0
-0
skin_detector.py
skin_detector/skin_detector.py
+12
-0
No files found.
.gitignore
View file @
359f84d3
...
@@ -92,4 +92,8 @@ ENV/
...
@@ -92,4 +92,8 @@ ENV/
# Intelija ID
# Intelija ID
.idea/
.idea/
\ No newline at end of file
.DS_Store
.vscode/
input/
output/
add_image.py
0 → 100644
View file @
359f84d3
import
cv2
import
skin_detector
import
os
def
skin_to_white
(
img_path
):
image
=
cv2
.
imread
(
img_path
)
mask
=
skin_detector
.
process
(
image
,
thresh
=
0.5
)
for
i
in
range
(
0
,
mask
.
shape
[
0
]):
for
j
in
range
(
0
,
mask
.
shape
[
1
]):
if
mask
[
i
,
j
]
==
255
:
image
[
i
,
j
]
=
255
img_path
=
img_path
.
replace
(
'input'
,
'output'
)
cv2
.
imwrite
(
img_path
,
image
)
def
input_files
():
files
=
os
.
listdir
(
'input'
)
for
file
in
files
:
img_path
=
'input/'
+
file
skin_to_white
(
img_path
)
print
(
img_path
)
if
__name__
==
'__main__'
:
input_files
()
#
# image = cv2.imread(img_path)
# mask = skin_detector.process(image)
#
# img_path = img_path.replace('input', 'output')
#
#
#
#
#
# cv2.imwrite('abc.jpg', mask)
#
# mask = cv2.imread('abc.jpg')
#
#
#
# img_add = cv2.addWeighted(image, 0.1, mask, 0.9, 0)
#
# cv2.imwrite(img_path, img_add)
tests
/test_image.png
→
input
/test_image.png
View file @
359f84d3
File moved
skin_detector/skin_detector.py
View file @
359f84d3
...
@@ -147,3 +147,15 @@ def process(img, thresh=0.5, debug=False):
...
@@ -147,3 +147,15 @@ def process(img, thresh=0.5, debug=False):
mask
=
grab_cut_mask
(
img
,
mask
,
debug
=
debug
)
mask
=
grab_cut_mask
(
img
,
mask
,
debug
=
debug
)
return
mask
return
mask
def
skin_to_white
(
img_path
):
image
=
cv2
.
imread
(
img_path
)
mask
=
process
(
image
,
thresh
=
0.5
)
for
i
in
range
(
0
,
mask
.
shape
[
0
]):
for
j
in
range
(
0
,
mask
.
shape
[
1
]):
if
mask
[
i
,
j
]
==
255
:
image
[
i
,
j
]
=
255
return
image
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment