Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
95887df0
Commit
95887df0
authored
Jul 12, 2015
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gave imglab the ability to jump to a specific image via a keyboard command.
parent
a3c98799
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
3 deletions
+33
-3
metadata_editor.cpp
tools/imglab/src/metadata_editor.cpp
+30
-3
metadata_editor.h
tools/imglab/src/metadata_editor.h
+3
-0
No files found.
tools/imglab/src/metadata_editor.cpp
View file @
95887df0
...
...
@@ -10,6 +10,7 @@
#include <dlib/array2d.h>
#include <dlib/pixel.h>
#include <sstream>
#include <ctime>
using
namespace
std
;
using
namespace
dlib
;
...
...
@@ -27,7 +28,9 @@ metadata_editor(
image_pos
(
0
),
display
(
*
this
),
overlay_label_name
(
*
this
),
overlay_label
(
*
this
)
overlay_label
(
*
this
),
keyboard_jump_pos
(
0
),
last_keyboard_jump_pos_update
(
0
)
{
file
metadata_file
(
filename_
);
filename
=
metadata_file
.
full_name
();
...
...
@@ -290,6 +293,29 @@ on_keydown (
overlay_label
.
select_all_text
();
}
// If the user types a number then jump to that image.
if
(
'0'
<=
key
&&
key
<=
'9'
&&
metadata
.
images
.
size
()
!=
0
&&
!
overlay_label
.
has_input_focus
())
{
time_t
curtime
=
time
(
0
);
// If it's been a while since the user typed numbers then forget the last jump
// position and start accumulating numbers over again.
if
(
curtime
-
last_keyboard_jump_pos_update
>=
2
)
keyboard_jump_pos
=
0
;
last_keyboard_jump_pos_update
=
curtime
;
keyboard_jump_pos
*=
10
;
keyboard_jump_pos
+=
key
-
'0'
;
if
(
keyboard_jump_pos
>=
metadata
.
images
.
size
())
keyboard_jump_pos
=
metadata
.
images
.
size
()
-
1
;
image_pos
=
keyboard_jump_pos
;
select_image
(
image_pos
);
}
else
{
last_keyboard_jump_pos_update
=
0
;
}
return
;
}
...
...
@@ -536,8 +562,9 @@ display_about(
"and drag allows you to navigate around the image. Holding ctrl and "
"left clicking a rectangle will give it the label from the Next Label field. "
"Holding shift + right click and then dragging allows you to move things around. "
"Finally, holding ctrl and pressing the up or down keyboard keys will propagate "
"rectangle labels from one image to the next and also skip empty images."
,
0
,
0
)
<<
endl
;
"Holding ctrl and pressing the up or down keyboard keys will propagate "
"rectangle labels from one image to the next and also skip empty images. "
"Finally, typing a number on the keyboard will jump you to a specific image."
,
0
,
0
)
<<
endl
;
message_box
(
"About Image Labeler"
,
sout
.
str
());
}
...
...
tools/imglab/src/metadata_editor.h
View file @
95887df0
...
...
@@ -55,6 +55,9 @@ private:
dlib
::
image_display
display
;
dlib
::
label
overlay_label_name
;
dlib
::
text_field
overlay_label
;
unsigned
long
keyboard_jump_pos
;
time_t
last_keyboard_jump_pos_update
;
};
// ----------------------------------------------------------------------------------------
...
...
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