Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tp_python_cv_pepin_leo
Project
Project
Details
Activity
Releases
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
PEPIN
tp_python_cv_pepin_leo
Commits
ea3ef703
Commit
ea3ef703
authored
Oct 26, 2019
by
Pépin Léo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout commentaire thresh bin inv
parent
18cce22c
Pipeline
#172
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
surveillance.py
Include/exercice_1/surveillance.py
+2
-2
No files found.
Include/exercice_1/surveillance.py
View file @
ea3ef703
...
@@ -27,7 +27,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10):
...
@@ -27,7 +27,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10):
continue
continue
diff_frame
=
cv2
.
absdiff
(
firstFrame
,
gray
)
diff_frame
=
cv2
.
absdiff
(
firstFrame
,
gray
)
threshold
=
cv2
.
threshold
(
diff_frame
,
30
,
255
,
cv2
.
THRESH_BINARY
)[
1
]
threshold
=
cv2
.
threshold
(
diff_frame
,
30
,
255
,
cv2
.
THRESH_BINARY
_INV
)[
1
]
#besoin de mettre Thresh_Binary_Inv pour ma caméra
threshold
=
cv2
.
dilate
(
threshold
,
None
,
iterations
=
2
)
threshold
=
cv2
.
dilate
(
threshold
,
None
,
iterations
=
2
)
whitePixel
=
np
.
sum
(
threshold
==
255
)
whitePixel
=
np
.
sum
(
threshold
==
255
)
...
@@ -37,7 +37,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10):
...
@@ -37,7 +37,7 @@ def save_webcam(path, fps=30, mirror=False, diff_percentage=10):
if
mirror
==
True
:
if
mirror
==
True
:
frame
=
cv2
.
flip
(
frame
,
1
)
frame
=
cv2
.
flip
(
frame
,
1
)
if
(
percentage
>=
diff_percentage
):
if
(
percentage
>=
diff_percentage
):
print
(
"/!
\\
WARNING /!
\\
: INTRUSION DETECTED
"
)
print
(
"/!
\\
WARNING /!
\\
: INTRUSION DETECTED
{}"
.
format
(
currentFrame
)
)
output
.
write
(
frame
)
output
.
write
(
frame
)
cv2
.
imshow
(
'diff'
,
diff_frame
)
cv2
.
imshow
(
'diff'
,
diff_frame
)
...
...
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