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
c1f5f32b
Commit
c1f5f32b
authored
May 24, 2018
by
Davis King
Browse files
Renamed convert_rgb_to_grayscale() to as_grayscale() and made it take any
numpy array as input.
parent
89ffae61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
tools/python/src/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
)
{
if
(
is_image
<
rgb_pixel
>
(
img
))
{
numpy_image
<
unsigned
char
>
out
;
assign_image
(
out
,
img
);
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