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
f9e01303
Commit
f9e01303
authored
Mar 23, 2015
by
WillBrennan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added mask closing operation
parent
7efbdc49
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
main.py
main.py
+8
-0
No files found.
main.py
View file @
f9e01303
...
...
@@ -62,6 +62,13 @@ class SkinDetector(object):
cv2
.
waitKey
(
0
)
self
.
add_mask
(
msk_rgb
)
@staticmethod
def
closing
(
msk
):
assert
isinstance
(
msk
,
numpy
.
ndarray
),
'msk must be a numpy array'
assert
msk
.
ndim
==
2
,
'msk must be a greyscale image'
kernel
=
cv2
.
getStructuringElement
(
cv2
.
MORPH_ELLIPSE
,
(
5
,
5
))
return
cv2
.
morphologyEx
(
msk
,
cv2
.
MORPH_CLOSE
,
kernel
)
def
process
(
self
,
img
):
logger
.
debug
(
'Initialising process'
)
dt
=
time
.
time
()
...
...
@@ -81,6 +88,7 @@ class SkinDetector(object):
dt
=
round
(
time
.
time
()
-
dt
,
2
)
hz
=
round
(
1
/
dt
,
2
)
logger
.
debug
(
'Conducted processing in {0}s ({1}Hz)'
.
format
(
dt
,
hz
))
self
.
mask
=
self
.
closing
(
self
.
mask
)
return
self
.
mask
def
add_mask
(
self
,
img
):
...
...
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