Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
10356e39
Commit
10356e39
authored
Sep 01, 2012
by
Davis King
Browse files
Added functions to easily add full_object_detections to the overlay
of an image_window.
parent
64e26c7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
119 additions
and
0 deletions
+119
-0
dlib/gui_widgets/widgets.h
dlib/gui_widgets/widgets.h
+73
-0
dlib/gui_widgets/widgets_abstract.h
dlib/gui_widgets/widgets_abstract.h
+46
-0
No files found.
dlib/gui_widgets/widgets.h
View file @
10356e39
...
...
@@ -3587,6 +3587,79 @@ namespace dlib
add_overlay
(
temp
);
}
void
add_overlay
(
const
full_object_detection
&
object
,
const
std
::
vector
<
std
::
string
>&
part_names
)
{
add_overlay
(
overlay_rect
(
object
.
get_rect
(),
rgb_pixel
(
255
,
0
,
0
)));
std
::
vector
<
overlay_circle
>
temp
;
temp
.
reserve
(
object
.
num_parts
());
for
(
unsigned
long
i
=
0
;
i
<
object
.
num_parts
();
++
i
)
{
if
(
object
.
part
(
i
)
!=
OBJECT_PART_NOT_PRESENT
)
{
if
(
i
<
part_names
.
size
())
temp
.
push_back
(
overlay_circle
(
object
.
part
(
i
),
7
,
rgb_pixel
(
0
,
255
,
0
),
part_names
[
i
]));
else
temp
.
push_back
(
overlay_circle
(
object
.
part
(
i
),
7
,
rgb_pixel
(
0
,
255
,
0
)));
}
}
add_overlay
(
temp
);
}
void
add_overlay
(
const
full_object_detection
&
object
)
{
std
::
vector
<
std
::
string
>
part_names
;
add_overlay
(
object
,
part_names
);
}
void
add_overlay
(
const
std
::
vector
<
full_object_detection
>&
objects
,
const
std
::
vector
<
std
::
string
>&
part_names
)
{
std
::
vector
<
overlay_rect
>
rtemp
;
rtemp
.
reserve
(
objects
.
size
());
for
(
unsigned
long
i
=
0
;
i
<
objects
.
size
();
++
i
)
{
rtemp
.
push_back
(
overlay_rect
(
objects
[
i
].
get_rect
(),
rgb_pixel
(
255
,
0
,
0
)));
}
add_overlay
(
rtemp
);
std
::
vector
<
overlay_circle
>
temp
;
for
(
unsigned
long
i
=
0
;
i
<
objects
.
size
();
++
i
)
{
for
(
unsigned
long
j
=
0
;
j
<
objects
[
i
].
num_parts
();
++
j
)
{
if
(
objects
[
i
].
part
(
j
)
!=
OBJECT_PART_NOT_PRESENT
)
{
if
(
j
<
part_names
.
size
())
temp
.
push_back
(
overlay_circle
(
objects
[
i
].
part
(
j
),
7
,
rgb_pixel
(
0
,
255
,
0
),
part_names
[
j
]));
else
temp
.
push_back
(
overlay_circle
(
objects
[
i
].
part
(
j
),
7
,
rgb_pixel
(
0
,
255
,
0
)));
}
}
}
add_overlay
(
temp
);
}
void
add_overlay
(
const
std
::
vector
<
full_object_detection
>&
objects
)
{
std
::
vector
<
std
::
string
>
part_names
;
add_overlay
(
objects
,
part_names
);
}
void
add_overlay
(
const
overlay_line
&
overlay
);
...
...
dlib/gui_widgets/widgets_abstract.h
View file @
10356e39
...
...
@@ -13,6 +13,7 @@
#include <map>
#include "../interfaces/enumerable.h"
#include "style_abstract.h"
#include "../image_processing/full_object_detection_abstract.h"
namespace
dlib
{
...
...
@@ -2856,6 +2857,51 @@ namespace dlib
that they will be displayed with the color specific by p.
!*/
void
add_overlay
(
const
full_object_detection
&
object
,
const
std
::
vector
<
std
::
string
>&
part_names
);
/*!
ensures
- adds the given full_object_detection to the overlays
and shows it on the screen. This includes any of its
parts that are not set equal to OBJECT_PART_NOT_PRESENT.
- for all valid i < part_names.size():
- the part object.part(i) will be labeled with the string
part_names[i].
!*/
void
add_overlay
(
const
full_object_detection
&
object
);
/*!
ensures
- adds the given full_object_detection to the overlays
and shows it on the screen. This includes any of its
parts that are not set equal to OBJECT_PART_NOT_PRESENT.
!*/
void
add_overlay
(
const
std
::
vector
<
full_object_detection
>&
objects
,
const
std
::
vector
<
std
::
string
>&
part_names
);
/*!
ensures
- calling this function is equivalent to calling the following
sequence of functions, for all valid i:
- add_overlay(objects[i], part_names);
!*/
void
add_overlay
(
const
std
::
vector
<
full_object_detection
>&
objects
);
/*!
ensures
- calling this function is equivalent to calling the following
sequence of functions, for all valid i:
- add_overlay(objects[i]);
!*/
void
add_overlay
(
const
overlay_line
&
overlay
);
...
...
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