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
3aad318e
"vscode:/vscode.git/clone" did not exist on "78094af459e46383ec13a40d74d4a9e86f69716d"
Commit
3aad318e
authored
Jun 18, 2018
by
Davis King
Browse files
Made add_overlay() work with more input types in python.
parent
dcec8867
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
tools/python/src/gui.cpp
tools/python/src/gui.cpp
+19
-0
No files found.
tools/python/src/gui.cpp
View file @
3aad318e
...
...
@@ -90,6 +90,23 @@ void add_overlay_line (
win
.
add_overlay
(
l
,
color
);
}
void
add_overlay_pylist
(
image_window
&
win
,
const
py
::
list
&
objs
,
const
rgb_pixel
&
color
)
{
std
::
vector
<
rectangle
>
rects
;
for
(
auto
&
obj
:
objs
)
{
try
{
rects
.
push_back
(
obj
.
cast
<
rectangle
>
());
continue
;
}
catch
(
py
::
cast_error
&
)
{
}
try
{
rects
.
push_back
(
obj
.
cast
<
drectangle
>
());
continue
;
}
catch
(
py
::
cast_error
&
)
{
}
try
{
win
.
add_overlay
(
obj
.
cast
<
line
>
(),
color
);
continue
;
}
catch
(
py
::
cast_error
&
)
{
}
add_overlay_parts
(
win
,
obj
.
cast
<
full_object_detection
>
(),
color
);
}
win
.
add_overlay
(
rects
,
color
);
}
template
<
typename
point_type
>
void
add_overlay_circle
(
image_window
&
win
,
...
...
@@ -221,6 +238,8 @@ void bind_gui(py::module& m)
"Add circle to the image window."
)
.
def
(
"add_overlay_circle"
,
add_overlay_circle
<
dpoint
>
,
py
::
arg
(
"center"
),
py
::
arg
(
"radius"
),
py
::
arg
(
"color"
)
=
rgb_pixel
(
255
,
0
,
0
),
"Add circle to the image window."
)
.
def
(
"add_overlay"
,
add_overlay_pylist
,
py
::
arg
(
"objects"
),
py
::
arg
(
"color"
)
=
rgb_pixel
(
255
,
0
,
0
),
"Adds all the overlayable objects, uses the given color."
)
.
def
(
"wait_until_closed"
,
&
type
::
wait_until_closed
,
"This function blocks until the window is closed."
);
}
...
...
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