Commit 2a735496 authored by Davis King's avatar Davis King

Made jet(), heatmap(), and randomly_color_image() work on matrix objects.

parent 3cc32d00
......@@ -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)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment