Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
a306deaf
Commit
a306deaf
authored
5 years ago
by
Iiro Rastas
Browse files
Options
Downloads
Patches
Plain Diff
Add 2D video recording
Adds 2D video recording option to the GUI.
parent
d3e66259
No related branches found
No related tags found
1 merge request
!179
Feature/219/gui record options
Pipeline
#16353
passed
5 years ago
Stage: all
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
applications/gui/src/camera.cpp
+22
-0
22 additions, 0 deletions
applications/gui/src/camera.cpp
applications/gui/src/camera.hpp
+3
-0
3 additions, 0 deletions
applications/gui/src/camera.hpp
applications/gui/src/media_panel.cpp
+9
-0
9 additions, 0 deletions
applications/gui/src/media_panel.cpp
with
34 additions
and
0 deletions
applications/gui/src/camera.cpp
+
22
−
0
View file @
a306deaf
...
...
@@ -137,6 +137,7 @@ ftl::gui::Camera::Camera(ftl::gui::Screen *screen, ftl::rgbd::Source *src) : scr
sdepth_
=
false
;
ftime_
=
(
float
)
glfwGetTime
();
pause_
=
false
;
videowriter_
=
std
::
nullopt
;
channel_
=
Channel
::
Left
;
...
...
@@ -488,6 +489,12 @@ const GLTexture &ftl::gui::Camera::captureFrame() {
//imageSize = Vector2f(rgb.cols,rgb.rows);
texture1_
.
update
(
im1_
);
}
if
(
videowriter_
)
{
cv
::
Mat
image
;
cv
::
flip
(
im1_
,
image
,
0
);
videowriter_
.
value
().
write
(
image
);
}
}
return
texture1_
;
...
...
@@ -503,6 +510,21 @@ void ftl::gui::Camera::snapshot() {
cv
::
imwrite
(
std
::
string
(
timestamp
)
+
".png"
,
image
);
}
void
ftl
::
gui
::
Camera
::
toggleVideoRecording
()
{
if
(
videowriter_
)
{
videowriter_
.
value
().
release
();
videowriter_
=
std
::
nullopt
;
}
else
{
char
timestamp
[
18
];
std
::
time_t
t
=
std
::
time
(
NULL
);
std
::
strftime
(
timestamp
,
sizeof
(
timestamp
),
"%F-%H%M%S"
,
std
::
localtime
(
&
t
));
videowriter_
=
std
::
optional
<
cv
::
VideoWriter
>
(
cv
::
VideoWriter
(
std
::
string
(
timestamp
)
+
".avi"
,
cv
::
VideoWriter
::
fourcc
(
'M'
,
'J'
,
'P'
,
'G'
),
screen_
->
root
()
->
value
(
"fps"
,
20
),
cv
::
Size
(
width
(),
height
())));
}
}
nlohmann
::
json
ftl
::
gui
::
Camera
::
getMetaData
()
{
return
nlohmann
::
json
();
}
This diff is collapsed.
Click to expand it.
applications/gui/src/camera.hpp
+
3
−
0
View file @
a306deaf
...
...
@@ -53,6 +53,8 @@ class Camera {
void
snapshot
();
void
toggleVideoRecording
();
nlohmann
::
json
getMetaData
();
StatisticsImage
*
stats_
=
nullptr
;
...
...
@@ -87,6 +89,7 @@ class Camera {
ftl
::
codecs
::
Channels
channels_
;
cv
::
Mat
im1_
;
// first channel (left)
cv
::
Mat
im2_
;
// second channel ("right")
std
::
optional
<
cv
::
VideoWriter
>
videowriter_
;
MUTEX
mutex_
;
...
...
This diff is collapsed.
Click to expand it.
applications/gui/src/media_panel.cpp
+
9
−
0
View file @
a306deaf
...
...
@@ -47,6 +47,15 @@ MediaPanel::MediaPanel(ftl::gui::Screen *screen) : nanogui::Window(screen, ""),
screen_
->
activeCamera
()
->
snapshot
();
});
itembutton
=
new
Button
(
recordpopup
,
"2D video recording"
);
itembutton
->
setFlags
(
Button
::
ToggleButton
);
itembutton
->
setChangeCallback
([
this
,
recordbutton
](
bool
state
)
{
screen_
->
activeCamera
()
->
toggleVideoRecording
();
if
(
state
)
{
recordbutton
->
setTextColor
(
nanogui
::
Color
(
1.0
f
,
0.1
f
,
0.1
f
,
1.0
f
));
}
else
{
recordbutton
->
setTextColor
(
nanogui
::
Color
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
));
}
});
itembutton
=
new
Button
(
recordpopup
,
"Depth video recording"
);
itembutton
->
setFlags
(
Button
::
ToggleButton
);
itembutton
->
setChangeCallback
([
this
,
recordbutton
](
bool
state
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment