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
2a735496
Commit
2a735496
authored
Oct 01, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made jet(), heatmap(), and randomly_color_image() work on matrix objects.
parent
3cc32d00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
colormaps.h
dlib/image_transforms/colormaps.h
+3
-3
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
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
)
{
const
uint32
h
=
murmur_hash3_2
(
gray
,
0
);
...
...
@@ -90,7 +90,7 @@ namespace dlib
const_ret_type
apply
(
long
r
,
long
c
)
const
{
// 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
);
pix
.
red
=
static_cast
<
unsigned
char
>
(
std
::
min
(
gray
/
0
.
4
,
1
.
0
)
*
255
+
0
.
5
);
...
...
@@ -164,7 +164,7 @@ namespace dlib
const_ret_type
apply
(
long
r
,
long
c
)
const
{
// 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
;
// s is the slope of color change
const
double
s
=
1
.
0
/
2
.
0
;
...
...
dlib/image_transforms/colormaps_abstract.h
View file @
2a735496
...
...
@@ -21,7 +21,8 @@ namespace dlib
);
/*!
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
ensures
- randomly generates a mapping from gray level pixel values
...
...
@@ -45,7 +46,8 @@ namespace dlib
);
/*!
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
ensures
- Interprets img as a grayscale image and returns a new matrix
...
...
@@ -66,7 +68,8 @@ namespace dlib
);
/*!
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
ensures
- returns heatmap(img, max(mat(img)), min(mat(img)))
...
...
@@ -85,7 +88,8 @@ namespace dlib
);
/*!
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
ensures
- Interprets img as a grayscale image and returns a new matrix which represents
...
...
@@ -106,7 +110,8 @@ namespace dlib
);
/*!
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
ensures
- 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