Commit 36a0776a authored by Davis King's avatar Davis King

Merge branch 'sutr90-lab_pixel'

parents 8c037c3c 83324898
......@@ -80,9 +80,9 @@ namespace dlib
impl::impl_save_png(file_name, row_pointers, img.nc(), impl::png_type_rgb_alpha, 8);
}
else if (pixel_traits<pixel_type>::hsi || pixel_traits<pixel_type>::rgb)
else if (pixel_traits<pixel_type>::lab || pixel_traits<pixel_type>::hsi || pixel_traits<pixel_type>::rgb)
{
// convert from HSI to RGB (Or potentially RGB pixels that aren't laid out as R G B)
// convert from Lab or HSI to RGB (Or potentially RGB pixels that aren't laid out as R G B)
array2d<rgb_pixel> temp_img;
assign_image(temp_img, img_);
for (unsigned long i = 0; i < row_pointers.size(); ++i)
......
......@@ -2573,7 +2573,8 @@ namespace dlib
pixel_traits<P>::grayscale,
pixel_traits<P>::rgb,
pixel_traits<P>::hsi,
pixel_traits<P>::rgb_alpha
pixel_traits<P>::rgb_alpha,
pixel_traits<P>::lab
>::value
>
struct pixel_to_vector_helper;
......@@ -2637,6 +2638,21 @@ namespace dlib
}
};
template <typename P>
struct pixel_to_vector_helper<P,5>
{
template <typename M>
static void assign (
M& m,
const P& pixel
)
{
m(0) = static_cast<typename M::type>(pixel.l);
m(1) = static_cast<typename M::type>(pixel.a);
m(2) = static_cast<typename M::type>(pixel.b);
}
};
template <
typename T,
......@@ -2660,7 +2676,8 @@ namespace dlib
pixel_traits<P>::grayscale,
pixel_traits<P>::rgb,
pixel_traits<P>::hsi,
pixel_traits<P>::rgb_alpha
pixel_traits<P>::rgb_alpha,
pixel_traits<P>::lab
>::value
>
struct vector_to_pixel_helper;
......@@ -2724,6 +2741,21 @@ namespace dlib
}
};
template <typename P>
struct vector_to_pixel_helper<P,5>
{
template <typename M>
static void assign (
P& pixel,
const M& m
)
{
pixel.l = static_cast<unsigned char>(m(0));
pixel.a = static_cast<unsigned char>(m(1));
pixel.b = static_cast<unsigned char>(m(2));
}
};
template <
typename P,
typename EXP
......
This diff is collapsed.
This diff is collapsed.
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