Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mirrorSimulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
李远洪
mirrorSimulator
Commits
9e675d61
Commit
9e675d61
authored
Jan 04, 2021
by
liyuanhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加了帧实时预览功能
parent
49a92319
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
+22
-9
opencv_videoio_ffmpeg440_64.dll
opencv_videoio_ffmpeg440_64.dll
+0
-0
ui/CameraArea.py
ui/CameraArea.py
+22
-9
No files found.
opencv_videoio_ffmpeg440_64.dll
0 → 100644
View file @
9e675d61
File added
ui/CameraArea.py
View file @
9e675d61
...
...
@@ -7,6 +7,7 @@ import time
import
traceback
import
platform
import
cv2
import
subprocess
import
requests
import
wx
...
...
@@ -118,9 +119,11 @@ class CameraArea():
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
disConnect
(
evt
),
disConnectButton
)
playStreamVideoButton
=
wx
.
Button
(
ctrView
,
label
=
"播放流地址"
,
pos
=
(
5
,
95
))
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
playFrame
(
evt
),
playStreamVideoButton
)
showFrameButton
=
wx
.
Button
(
ctrView
,
label
=
"实时显示帧画面"
,
pos
=
(
120
,
95
))
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
showFrame
(
evt
),
showFrameButton
)
StopPlayStreamVideoButton
=
wx
.
Button
(
ctrView
,
label
=
"停止播放"
,
pos
=
(
5
,
125
))
#
StopPlayStreamVideoButton = wx.Button(ctrView, label="停止播放", pos=(5, 125))
stopShowFrameButton
=
wx
.
Button
(
ctrView
,
label
=
"停止显示帧画面"
,
pos
=
(
120
,
125
))
self
.
frame
.
Bind
(
wx
.
EVT_BUTTON
,
lambda
evt
:
self
.
stopShowFrame
(
evt
),
stopShowFrameButton
)
...
...
@@ -157,11 +160,9 @@ class CameraArea():
boxSizer_ctrArea
.
Add
(
ctrPanel
,
100
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
ctrArea
.
SetSizer
(
boxSizer_ctrArea
)
boxSizer_bottom
.
Add
(
logArea
,
60
,
flag
=
wx
.
EXPAND
|
wx
.
ALL
)
boxSizer_bottom
.
Add
(
ctrArea
,
40
,
flag
=
wx
.
EXPAND
|
wx
.
LEFT
,
border
=
10
)
bottomPanel
.
SetSizer
(
boxSizer_bottom
)
return
bottomPanel
#################################################
...
...
@@ -223,7 +224,6 @@ class CameraArea():
else
:
timeCur
=
self
.
getCurTime
()
self
.
logTextCtr
.
WriteText
(
timeCur
+
"已连网!
\n
"
)
def
doConnect
(
self
):
host
=
self
.
pushHostText
.
GetValue
()
port
=
self
.
pushPortText
.
GetValue
()
...
...
@@ -364,7 +364,7 @@ class CameraArea():
def
showFrame
(
self
,
evt
):
sys
.
stdout
=
self
.
logTextCtr
sys
.
stderr
=
self
.
logTextCtr
threadObj
=
threading
.
Thread
(
target
=
self
.
doShowFrame
()
)
threadObj
=
threading
.
Thread
(
target
=
self
.
doShowFrame
)
threadObj
.
start
()
def
doShowFrame
(
self
):
self
.
isShowFrame
=
1
...
...
@@ -373,8 +373,8 @@ class CameraArea():
res
=
requests
.
post
(
self
.
getGetPlayUrl
,
data
=
json
.
dumps
({
'devId'
:
devId
,
'chan'
:
str
(
channel
)}))
.
text
res
=
json
.
loads
(
res
)
pullUrl
=
res
[
"data"
][
"url"
]
cap
=
cv2
.
VideoCapture
(
pullUrl
)
try
:
cap
=
cv2
.
VideoCapture
(
pullUrl
)
timeCur
=
self
.
getCurTime
()
self
.
logTextCtr
.
WriteText
(
timeCur
+
"帧预览开始!
\n
"
)
while
(
cap
.
isOpened
()):
...
...
@@ -399,7 +399,7 @@ class CameraArea():
def
stopShowFrame
(
self
,
evt
):
sys
.
stdout
=
self
.
logTextCtr
sys
.
stderr
=
self
.
logTextCtr
threadObj
=
threading
.
Thread
(
target
=
self
.
stopDoShowFrame
()
)
threadObj
=
threading
.
Thread
(
target
=
self
.
stopDoShowFrame
)
threadObj
.
start
()
def
stopDoShowFrame
(
self
):
self
.
isShowFrame
=
0
...
...
@@ -407,6 +407,19 @@ class CameraArea():
####################################################
# 播放视频地址
###################################################
def
playFrame
(
self
):
pass
def
playFrame
(
self
,
evt
):
sys
.
stdout
=
self
.
logTextCtr
sys
.
stderr
=
self
.
logTextCtr
threadObj
=
threading
.
Thread
(
target
=
self
.
doPlayFrame
)
threadObj
.
start
()
timeCur
=
self
.
getCurTime
()
self
.
logTextCtr
.
WriteText
(
timeCur
+
"开始播放视频!
\n
"
)
def
doPlayFrame
(
self
):
devId
=
self
.
devIdText
.
GetValue
()
channel
=
self
.
channelText
.
GetValue
()
res
=
requests
.
post
(
self
.
getGetPlayUrl
,
data
=
json
.
dumps
({
'devId'
:
devId
,
'chan'
:
str
(
channel
)}))
.
text
res
=
json
.
loads
(
res
)
url
=
res
[
"data"
][
"url"
]
m_command
=
[
"ffplay.exe"
,
url
]
subprocess
.
run
(
m_command
)
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