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
89ffae61
Commit
89ffae61
authored
May 25, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added load_grayscale_image() to the Python API
parent
840bb5bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
numpy_returns.cpp
tools/python/src/numpy_returns.cpp
+15
-3
No files found.
tools/python/src/numpy_returns.cpp
View file @
89ffae61
...
...
@@ -20,6 +20,13 @@ numpy_image<rgb_pixel> load_rgb_image (const std::string &path)
return
img
;
}
numpy_image
<
unsigned
char
>
load_grayscale_image
(
const
std
::
string
&
path
)
{
numpy_image
<
unsigned
char
>
img
;
load_image
(
img
,
path
);
return
img
;
}
bool
has_ending
(
std
::
string
const
full_string
,
std
::
string
const
&
ending
)
{
if
(
full_string
.
length
()
>=
ending
.
length
())
{
return
(
0
==
full_string
.
compare
(
full_string
.
length
()
-
ending
.
length
(),
ending
.
length
(),
ending
));
...
...
@@ -121,16 +128,21 @@ void bind_numpy_returns(py::module &m)
{
m
.
def
(
"load_rgb_image"
,
&
load_rgb_image
,
"Takes a path and returns a numpy array (RGB) containing the image"
,
py
::
arg
(
"path"
)
py
::
arg
(
"filename"
)
);
m
.
def
(
"load_grayscale_image"
,
&
load_grayscale_image
,
"Takes a path and returns a numpy array containing the image, as an 8bit grayscale image."
,
py
::
arg
(
"filename"
)
);
m
.
def
(
"save_image"
,
&
save_image
<
rgb_pixel
>
,
"Saves the given image to the specified path. Determines the file type from the file extension specified in the path"
,
py
::
arg
(
"img"
),
py
::
arg
(
"
path
"
)
py
::
arg
(
"img"
),
py
::
arg
(
"
filename
"
)
);
m
.
def
(
"save_image"
,
&
save_image
<
unsigned
char
>
,
"Saves the given image to the specified path. Determines the file type from the file extension specified in the path"
,
py
::
arg
(
"img"
),
py
::
arg
(
"
path
"
)
py
::
arg
(
"img"
),
py
::
arg
(
"
filename
"
)
);
m
.
def
(
"jitter_image"
,
&
get_jitter_images
,
...
...
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