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
52322e5a
Commit
52322e5a
authored
Apr 17, 2018
by
Davis King
Browse files
Made convert_to_numpy() take an rvalue reference so that it's really explicit
that it's going to move the matrix into the result.
parent
905074f2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
tools/python/src/numpy_returns.cpp
tools/python/src/numpy_returns.cpp
+5
-5
No files found.
tools/python/src/numpy_returns.cpp
View file @
52322e5a
...
...
@@ -10,7 +10,7 @@ using namespace std;
namespace
py
=
pybind11
;
py
::
array_t
<
uint8_t
>
convert_to_numpy
(
matrix
<
rgb_pixel
>
&
rgb_image
)
py
::
array_t
<
uint8_t
>
convert_to_numpy
(
matrix
<
rgb_pixel
>&
&
rgb_image
)
{
const
size_t
dtype_size
=
sizeof
(
uint8_t
);
const
auto
rows
=
static_cast
<
const
size_t
>
(
num_rows
(
rgb_image
));
...
...
@@ -39,7 +39,7 @@ py::array_t<uint8_t> load_rgb_image (const std::string &path)
{
matrix
<
rgb_pixel
>
img
;
load_image
(
img
,
path
);
return
convert_to_numpy
(
img
);
return
convert_to_numpy
(
std
::
move
(
img
)
)
;
}
bool
has_ending
(
std
::
string
const
full_string
,
std
::
string
const
&
ending
)
{
...
...
@@ -95,7 +95,7 @@ py::list get_jitter_images(py::object img, size_t num_jitters = 1, bool disturb_
dlib
::
disturb_colors
(
crop
,
rnd_jitter
);
// Convert image to Numpy array
py
::
array_t
<
uint8_t
>
arr
=
convert_to_numpy
(
crop
);
py
::
array_t
<
uint8_t
>
arr
=
convert_to_numpy
(
std
::
move
(
crop
)
)
;
// Append image to jittered image list
jitter_list
.
append
(
arr
);
...
...
@@ -131,7 +131,7 @@ py::list get_face_chips (
for
(
auto
&
chip
:
face_chips
)
{
// Convert image to Numpy array
py
::
array_t
<
uint8_t
>
arr
=
convert_to_numpy
(
chip
);
py
::
array_t
<
uint8_t
>
arr
=
convert_to_numpy
(
std
::
move
(
chip
)
)
;
// Append image to chips list
chips_list
.
append
(
arr
);
...
...
@@ -151,7 +151,7 @@ py::array_t<uint8_t> get_face_chip (
matrix
<
rgb_pixel
>
chip
;
extract_image_chip
(
numpy_rgb_image
(
img
),
get_face_chip_details
(
face
,
size
,
padding
),
chip
);
return
convert_to_numpy
(
chip
);
return
convert_to_numpy
(
std
::
move
(
chip
)
)
;
}
// ----------------------------------------------------------------------------------------
...
...
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