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
2a735496
Commit
2a735496
authored
Sep 30, 2013
by
Davis King
Browse files
Made jet(), heatmap(), and randomly_color_image() work on matrix objects.
parent
3cc32d00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
dlib/image_transforms/colormaps.h
dlib/image_transforms/colormaps.h
+3
-3
dlib/image_transforms/colormaps_abstract.h
dlib/image_transforms/colormaps_abstract.h
+10
-5
No files found.
dlib/image_transforms/colormaps.h
View file @
2a735496
...
@@ -30,7 +30,7 @@ namespace dlib
...
@@ -30,7 +30,7 @@ namespace dlib
const_ret_type
apply
(
long
r
,
long
c
)
const
const_ret_type
apply
(
long
r
,
long
c
)
const
{
{
const
unsigned
long
gray
=
get_pixel_intensity
(
img
[
r
][
c
]
);
const
unsigned
long
gray
=
get_pixel_intensity
(
mat
(
img
)(
r
,
c
)
);
if
(
gray
!=
0
)
if
(
gray
!=
0
)
{
{
const
uint32
h
=
murmur_hash3_2
(
gray
,
0
);
const
uint32
h
=
murmur_hash3_2
(
gray
,
0
);
...
@@ -90,7 +90,7 @@ namespace dlib
...
@@ -90,7 +90,7 @@ namespace dlib
const_ret_type
apply
(
long
r
,
long
c
)
const
const_ret_type
apply
(
long
r
,
long
c
)
const
{
{
// scale the gray value into the range [0, 1]
// scale the gray value into the range [0, 1]
const
double
gray
=
put_in_range
(
0
,
1
,
(
get_pixel_intensity
(
img
[
r
][
c
]
)
-
min_val
)
/
(
max_val
-
min_val
));
const
double
gray
=
put_in_range
(
0
,
1
,
(
get_pixel_intensity
(
mat
(
img
)(
r
,
c
)
)
-
min_val
)
/
(
max_val
-
min_val
));
rgb_pixel
pix
(
0
,
0
,
0
);
rgb_pixel
pix
(
0
,
0
,
0
);
pix
.
red
=
static_cast
<
unsigned
char
>
(
std
::
min
(
gray
/
0.4
,
1.0
)
*
255
+
0.5
);
pix
.
red
=
static_cast
<
unsigned
char
>
(
std
::
min
(
gray
/
0.4
,
1.0
)
*
255
+
0.5
);
...
@@ -164,7 +164,7 @@ namespace dlib
...
@@ -164,7 +164,7 @@ namespace dlib
const_ret_type
apply
(
long
r
,
long
c
)
const
const_ret_type
apply
(
long
r
,
long
c
)
const
{
{
// scale the gray value into the range [0, 8]
// scale the gray value into the range [0, 8]
const
double
gray
=
8
*
put_in_range
(
0
,
1
,
(
get_pixel_intensity
(
img
[
r
][
c
]
)
-
min_val
)
/
(
max_val
-
min_val
));
const
double
gray
=
8
*
put_in_range
(
0
,
1
,
(
get_pixel_intensity
(
mat
(
img
)(
r
,
c
)
)
-
min_val
)
/
(
max_val
-
min_val
));
rgb_pixel
pix
;
rgb_pixel
pix
;
// s is the slope of color change
// s is the slope of color change
const
double
s
=
1.0
/
2.0
;
const
double
s
=
1.0
/
2.0
;
...
...
dlib/image_transforms/colormaps_abstract.h
View file @
2a735496
...
@@ -21,7 +21,8 @@ namespace dlib
...
@@ -21,7 +21,8 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- image_type is an implementation of array2d/array2d_kernel_abstract.h
- image_type is an implementation of array2d/array2d_kernel_abstract.h, a
dlib::matrix, or something convertible to a matrix via mat().
- pixel_traits<image_type::type> must be defined
- pixel_traits<image_type::type> must be defined
ensures
ensures
- randomly generates a mapping from gray level pixel values
- randomly generates a mapping from gray level pixel values
...
@@ -45,7 +46,8 @@ namespace dlib
...
@@ -45,7 +46,8 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- image_type is an implementation of array2d/array2d_kernel_abstract.h
- image_type is an implementation of array2d/array2d_kernel_abstract.h, a
dlib::matrix, or something convertible to a matrix via mat().
- pixel_traits<image_type::type> must be defined
- pixel_traits<image_type::type> must be defined
ensures
ensures
- Interprets img as a grayscale image and returns a new matrix
- Interprets img as a grayscale image and returns a new matrix
...
@@ -66,7 +68,8 @@ namespace dlib
...
@@ -66,7 +68,8 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- image_type is an implementation of array2d/array2d_kernel_abstract.h
- image_type is an implementation of array2d/array2d_kernel_abstract.h, a
dlib::matrix, or something convertible to a matrix via mat().
- pixel_traits<image_type::type> must be defined
- pixel_traits<image_type::type> must be defined
ensures
ensures
- returns heatmap(img, max(mat(img)), min(mat(img)))
- returns heatmap(img, max(mat(img)), min(mat(img)))
...
@@ -85,7 +88,8 @@ namespace dlib
...
@@ -85,7 +88,8 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- image_type is an implementation of array2d/array2d_kernel_abstract.h
- image_type is an implementation of array2d/array2d_kernel_abstract.h, a
dlib::matrix, or something convertible to a matrix via mat().
- pixel_traits<image_type::type> must be defined
- pixel_traits<image_type::type> must be defined
ensures
ensures
- Interprets img as a grayscale image and returns a new matrix which represents
- Interprets img as a grayscale image and returns a new matrix which represents
...
@@ -106,7 +110,8 @@ namespace dlib
...
@@ -106,7 +110,8 @@ namespace dlib
);
);
/*!
/*!
requires
requires
- image_type is an implementation of array2d/array2d_kernel_abstract.h
- image_type is an implementation of array2d/array2d_kernel_abstract.h, a
dlib::matrix, or something convertible to a matrix via mat().
- pixel_traits<image_type::type> must be defined
- pixel_traits<image_type::type> must be defined
ensures
ensures
- returns jet(img, max(mat(img)), min(mat(img)))
- returns jet(img, max(mat(img)), min(mat(img)))
...
...
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