mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Made jet(), heatmap(), and randomly_color_image() work on matrix objects.
This commit is contained in:
parent
3cc32d006b
commit
2a735496d0
@ -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;
|
||||
|
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user