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
c1f5f32b
Commit
c1f5f32b
authored
May 25, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed convert_rgb_to_grayscale() to as_grayscale() and made it take any
numpy array as input.
parent
89ffae61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
image.cpp
tools/python/src/image.cpp
+14
-7
No files found.
tools/python/src/image.cpp
View file @
c1f5f32b
...
...
@@ -225,13 +225,20 @@ py::array convert_image (
"uint8, int8, uint16, int16, uint32, int32, uint64, int64, float32, float, float64, double, or rgb_pixel"
);
}
numpy_image
<
unsigned
char
>
convert_rgb_to
_grayscale
(
const
numpy_image
<
rgb_pixel
>
&
img
py
::
array
as
_grayscale
(
const
py
::
array
&
img
)
{
numpy_image
<
unsigned
char
>
out
;
assign_image
(
out
,
img
);
return
out
;
if
(
is_image
<
rgb_pixel
>
(
img
))
{
numpy_image
<
unsigned
char
>
out
;
assign_image
(
out
,
numpy_image
<
rgb_pixel
>
(
img
));
return
out
;
}
else
{
return
img
;
}
}
// ----------------------------------------------------------------------------------------
...
...
@@ -1067,8 +1074,8 @@ than 0 are converted to 0.";
m
.
def
(
"convert_image"
,
convert_image
<
double
>
,
py
::
arg
(
"img"
),
py
::
arg
(
"dtype"
));
m
.
def
(
"convert_image"
,
convert_image
<
rgb_pixel
>
,
docs
,
py
::
arg
(
"img"
),
py
::
arg
(
"dtype"
));
m
.
def
(
"
convert_rgb_to_grayscale"
,
&
convert_rgb_to
_grayscale
,
"Convert a
RGB image to a uint8 grayscale image
."
,
py
::
arg
(
"img"
));
m
.
def
(
"
as_grayscale"
,
&
as
_grayscale
,
"Convert a
n image to 8bit grayscale. If it's already a grayscale image do nothing and just return img
."
,
py
::
arg
(
"img"
));
docs
=
"requires
\n
\
...
...
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