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
52e7ab68
Commit
52e7ab68
authored
May 20, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made image_window use numpy_image explicitly so it benefits from numpy_image's
automatic binding.
parent
cafd6a0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
12 deletions
+16
-12
gui.cpp
tools/python/src/gui.cpp
+16
-12
No files found.
tools/python/src/gui.cpp
View file @
52e7ab68
...
...
@@ -33,17 +33,13 @@ void image_window_set_image_simple_detector_py (
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
void
image_window_set_image
(
image_window
&
win
,
py
::
array
img
const
numpy_image
<
T
>&
img
)
{
if
(
is_image
<
unsigned
char
>
(
img
))
return
win
.
set_image
(
numpy_image
<
unsigned
char
>
(
img
));
else
if
(
is_image
<
rgb_pixel
>
(
img
))
return
win
.
set_image
(
numpy_image
<
rgb_pixel
>
(
img
));
else
throw
dlib
::
error
(
"Unsupported image type, must be 8bit gray or RGB image."
);
win
.
set_image
(
img
);
}
void
add_overlay_rect
(
...
...
@@ -74,14 +70,16 @@ void add_overlay_parts (
win
.
add_overlay
(
render_face_detections
(
detection
,
color
));
}
std
::
shared_ptr
<
image_window
>
make_image_window_from_image
(
py
::
array
img
)
template
<
typename
T
>
std
::
shared_ptr
<
image_window
>
make_image_window_from_image
(
const
numpy_image
<
T
>&
img
)
{
auto
win
=
std
::
make_shared
<
image_window
>
();
image_window_set_image
(
*
win
,
img
);
return
win
;
}
std
::
shared_ptr
<
image_window
>
make_image_window_from_image_and_title
(
py
::
array
img
,
const
string
&
title
)
template
<
typename
T
>
std
::
shared_ptr
<
image_window
>
make_image_window_from_image_and_title
(
const
numpy_image
<
T
>&
img
,
const
string
&
title
)
{
auto
win
=
std
::
make_shared
<
image_window
>
();
image_window_set_image
(
*
win
,
img
);
...
...
@@ -100,15 +98,21 @@ void bind_gui(py::module& m)
py
::
class_
<
type
,
std
::
shared_ptr
<
type
>>
(
m
,
"image_window"
,
"This is a GUI window capable of showing images on the screen."
)
.
def
(
py
::
init
())
.
def
(
py
::
init
(
&
make_image_window_from_image
),
.
def
(
py
::
init
(
&
make_image_window_from_image
<
uint8_t
>
),
"Create an image window that displays the given numpy image."
)
.
def
(
py
::
init
(
&
make_image_window_from_image_and_title
),
.
def
(
py
::
init
(
&
make_image_window_from_image
<
rgb_pixel
>
),
"Create an image window that displays the given numpy image."
)
.
def
(
py
::
init
(
&
make_image_window_from_image_and_title
<
uint8_t
>
),
"Create an image window that displays the given numpy image and also has the given title."
)
.
def
(
py
::
init
(
&
make_image_window_from_image_and_title
<
rgb_pixel
>
),
"Create an image window that displays the given numpy image and also has the given title."
)
.
def
(
"set_image"
,
image_window_set_image_simple_detector_py
,
py
::
arg
(
"detector"
),
"Make the image_window display the given HOG detector's filters."
)
.
def
(
"set_image"
,
image_window_set_image_fhog_detector
,
py
::
arg
(
"detector"
),
"Make the image_window display the given HOG detector's filters."
)
.
def
(
"set_image"
,
image_window_set_image
,
py
::
arg
(
"image"
),
.
def
(
"set_image"
,
image_window_set_image
<
uint8_t
>
,
py
::
arg
(
"image"
),
"Make the image_window display the given image."
)
.
def
(
"set_image"
,
image_window_set_image
<
rgb_pixel
>
,
py
::
arg
(
"image"
),
"Make the image_window display the given image."
)
.
def
(
"set_title"
,
(
set_title_funct
)
&
type
::
set_title
,
py
::
arg
(
"title"
),
"Set the title of the window to the given value."
)
...
...
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