Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
34b82ff0
Commit
34b82ff0
authored
Feb 28, 2017
by
Maksim Shabunin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1027 from berak:fix_motempl_py
parents
29286b3b
3f7e74db
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
motempl.py
modules/optflow/samples/motempl.py
+4
-1
No files found.
modules/optflow/samples/motempl.py
View file @
34b82ff0
...
...
@@ -37,7 +37,8 @@ if __name__ == '__main__':
sys
.
exit
(
1
)
ret
,
frame
=
cam
.
read
()
if
ret
==
False
:
break
print
(
"could not read from "
+
str
(
video_src
)
+
" !
\n
"
)
sys
.
exit
(
1
)
h
,
w
=
frame
.
shape
[:
2
]
prev_frame
=
frame
.
copy
()
motion_history
=
np
.
zeros
((
h
,
w
),
np
.
float32
)
...
...
@@ -45,6 +46,8 @@ if __name__ == '__main__':
hsv
[:,:,
1
]
=
255
while
True
:
ret
,
frame
=
cam
.
read
()
if
ret
==
False
:
break
frame_diff
=
cv2
.
absdiff
(
frame
,
prev_frame
)
gray_diff
=
cv2
.
cvtColor
(
frame_diff
,
cv2
.
COLOR_BGR2GRAY
)
thrs
=
cv2
.
getTrackbarPos
(
'threshold'
,
'motempl'
)
...
...
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