Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AAU NAV
development
camera_streaming
Commits
129b9fe6
Commit
129b9fe6
authored
Feb 20, 2020
by
Barciś, Agata
Browse files
detected mask inverted
parent
ec6ca4be
Changes
2
Hide whitespace changes
Inline
Side-by-side
camera_streaming/camera_subscriber.py
View file @
129b9fe6
...
@@ -186,6 +186,7 @@ class CameraSubscriber(Node, MissionExecutor):
...
@@ -186,6 +186,7 @@ class CameraSubscriber(Node, MissionExecutor):
npimg
=
np
.
frombuffer
(
img
,
dtype
=
np
.
uint8
)
npimg
=
np
.
frombuffer
(
img
,
dtype
=
np
.
uint8
)
img
=
cv2
.
imdecode
(
npimg
,
cv2
.
IMREAD_COLOR
)
img
=
cv2
.
imdecode
(
npimg
,
cv2
.
IMREAD_COLOR
)
mask
=
detect_red
(
img
)
mask
=
detect_red
(
img
)
mask
=
cv2
.
bitwise_not
(
mask
)
img
=
cv2
.
bitwise_and
(
img
,
img
,
mask
=
mask
)
/
256
img
=
cv2
.
bitwise_and
(
img
,
img
,
mask
=
mask
)
/
256
host_id
=
self
.
hosts
[
host
]
host_id
=
self
.
hosts
[
host
]
place
=
(
place
=
(
...
...
camera_streaming/detect.py
View file @
129b9fe6
...
@@ -20,7 +20,4 @@ def detect_red(img):
...
@@ -20,7 +20,4 @@ def detect_red(img):
mask
=
cv2
.
morphologyEx
(
mask
,
cv2
.
MORPH_OPEN
,
np
.
ones
((
3
,
3
),
np
.
uint8
))
mask
=
cv2
.
morphologyEx
(
mask
,
cv2
.
MORPH_OPEN
,
np
.
ones
((
3
,
3
),
np
.
uint8
))
mask
=
cv2
.
morphologyEx
(
mask
,
cv2
.
MORPH_DILATE
,
np
.
ones
((
3
,
3
),
np
.
uint8
))
mask
=
cv2
.
morphologyEx
(
mask
,
cv2
.
MORPH_DILATE
,
np
.
ones
((
3
,
3
),
np
.
uint8
))
return
mask
# creating an inverted mask
mask_black
=
cv2
.
bitwise_not
(
mask
)
return
mask_black
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