"examples/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "672e3227190f54637ce6aa0d76c8c1162269781d"
Unverified Commit a8324201 authored by stoperro's avatar stoperro Committed by GitHub
Browse files

Corrected interpolate_bilinear for lab_pixel. (#2091)

* * Corrected interpolate_bilinear for non-RGB images not to collapse into grayscale (#2089)

* * interpolate_bilinear uses now pixel_to_vector for shorter code.

* pixels now have operator!=.

* * Explicitely float interpolation

* Using C++11 static_assert() in interpolation.

* * Corrected documentation for interpolate_bilinear, interpolate_quadratic

* * Corrected formatting near interpolate_bilinear
parent 693aa0a7
...@@ -133,6 +133,16 @@ namespace dlib ...@@ -133,6 +133,16 @@ namespace dlib
template <typename image_type> template <typename image_type>
struct is_rgb_image { const static bool value = pixel_traits<typename image_traits<image_type>::pixel_type>::rgb; }; struct is_rgb_image { const static bool value = pixel_traits<typename image_traits<image_type>::pixel_type>::rgb; };
template <typename image_type>
struct is_color_space_cartesian_image { const static bool value =
pixel_traits<typename image_traits<image_type>::pixel_type>::rgb ||
pixel_traits<typename image_traits<image_type>::pixel_type>::lab ||
pixel_traits<typename image_traits<image_type>::pixel_type>::grayscale; };
/*
Tells if all color components of image pixels are in cartesian coordinates, compared to e.g. polar coordinates.
Polar coordinates that may require more complicated blending.
*/
template <typename image_type> template <typename image_type>
struct is_grayscale_image { const static bool value = pixel_traits<typename image_traits<image_type>::pixel_type>::grayscale; }; struct is_grayscale_image { const static bool value = pixel_traits<typename image_traits<image_type>::pixel_type>::grayscale; };
......
...@@ -229,58 +229,25 @@ namespace dlib ...@@ -229,58 +229,25 @@ namespace dlib
class interpolate_bilinear class interpolate_bilinear
{ {
public: public:
template <typename T, typename image_view_type, typename pixel_type> template <typename T, typename image_view_type, typename pixel_type>
typename disable_if<is_rgb_image<image_view_type>,bool>::type operator() ( bool operator() (
const image_view_type& img, const image_view_type& img,
const dlib::vector<T,2>& p, const dlib::vector<T,2>& p,
pixel_type& result pixel_type& result
) const ) const
{ {
COMPILE_TIME_ASSERT(pixel_traits<typename image_view_type::pixel_type>::has_alpha == false); // Assign pixel gives special meaning to alpha channel that would break interpolation
static_assert(pixel_traits<typename image_view_type::pixel_type>::has_alpha == false, "Images with alpha channel not supported");
const long left = static_cast<long>(std::floor(p.x())); // Interpolation currently supports only fully cartesian (non-polar) spaces.
const long top = static_cast<long>(std::floor(p.y())); static_assert(is_color_space_cartesian_image<image_view_type>::value == true, "Non-cartesian color space used in interpolation");
const long right = left+1;
const long bottom = top+1;
// if the interpolation goes outside img
if (!(left >= 0 && top >= 0 && right < img.nc() && bottom < img.nr()))
return false;
const double lr_frac = p.x() - left;
const double tb_frac = p.y() - top;
double tl = 0, tr = 0, bl = 0, br = 0; using traits = pixel_traits<typename image_view_type::pixel_type>;
assign_pixel(tl, img[top][left]);
assign_pixel(tr, img[top][right]);
assign_pixel(bl, img[bottom][left]);
assign_pixel(br, img[bottom][right]);
double temp = (1-tb_frac)*((1-lr_frac)*tl + lr_frac*tr) +
tb_frac*((1-lr_frac)*bl + lr_frac*br);
assign_pixel(result, temp);
return true;
}
template <typename T, typename image_view_type, typename pixel_type>
typename enable_if<is_rgb_image<image_view_type>,bool>::type operator() (
const image_view_type& img,
const dlib::vector<T,2>& p,
pixel_type& result
) const
{
COMPILE_TIME_ASSERT(pixel_traits<typename image_view_type::pixel_type>::has_alpha == false);
const long left = static_cast<long>(std::floor(p.x())); const long left = static_cast<long>(std::floor(p.x()));
const long top = static_cast<long>(std::floor(p.y())); const long top = static_cast<long>(std::floor(p.y()));
const long right = left+1; const long right = left+1;
const long bottom = top+1; const long bottom = top+1;
// if the interpolation goes outside img // if the interpolation goes outside img
if (!(left >= 0 && top >= 0 && right < img.nc() && bottom < img.nr())) if (!(left >= 0 && top >= 0 && right < img.nc() && bottom < img.nr()))
return false; return false;
...@@ -288,36 +255,20 @@ namespace dlib ...@@ -288,36 +255,20 @@ namespace dlib
const double lr_frac = p.x() - left; const double lr_frac = p.x() - left;
const double tb_frac = p.y() - top; const double tb_frac = p.y() - top;
double tl, tr, bl, br; auto const tl = pixel_to_vector<double>(img[top][left]);
auto const tr = pixel_to_vector<double>(img[top][right]);
tl = img[top][left].red; auto const bl = pixel_to_vector<double>(img[bottom][left]);
tr = img[top][right].red; auto const br = pixel_to_vector<double>(img[bottom][right]);
bl = img[bottom][left].red; matrix<double, traits::num, 1> pvout;
br = img[bottom][right].red; for (long i = 0; i < traits::num; ++i)
const double red = (1-tb_frac)*((1-lr_frac)*tl + lr_frac*tr) + pvout(i) = (1 - tb_frac) * ((1 - lr_frac) * tl(i) + lr_frac * tr(i)) +
tb_frac*((1-lr_frac)*bl + lr_frac*br); tb_frac * ((1 - lr_frac) * bl(i) + lr_frac * br(i));
typename image_view_type::pixel_type temp;
tl = img[top][left].green; vector_to_pixel(temp, pvout);
tr = img[top][right].green;
bl = img[bottom][left].green;
br = img[bottom][right].green;
const double green = (1-tb_frac)*((1-lr_frac)*tl + lr_frac*tr) +
tb_frac*((1-lr_frac)*bl + lr_frac*br);
tl = img[top][left].blue;
tr = img[top][right].blue;
bl = img[bottom][left].blue;
br = img[bottom][right].blue;
const double blue = (1-tb_frac)*((1-lr_frac)*tl + lr_frac*tr) +
tb_frac*((1-lr_frac)*bl + lr_frac*br);
rgb_pixel temp;
assign_pixel(temp.red, red);
assign_pixel(temp.green, green);
assign_pixel(temp.blue, blue);
assign_pixel(result, temp); assign_pixel(result, temp);
return true; return true;
} }
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -328,94 +279,43 @@ namespace dlib ...@@ -328,94 +279,43 @@ namespace dlib
public: public:
template <typename T, typename image_view_type, typename pixel_type> template <typename T, typename image_view_type, typename pixel_type>
typename disable_if<is_rgb_image<image_view_type>,bool>::type operator() ( bool operator() (
const image_view_type& img, const image_view_type& img,
const dlib::vector<T,2>& p, const dlib::vector<T,2>& p,
pixel_type& result pixel_type& result
) const ) const
{ {
COMPILE_TIME_ASSERT(pixel_traits<typename image_view_type::pixel_type>::has_alpha == false); // Assign pixel gives special meaning to alpha channel that would break interpolation
static_assert(pixel_traits<typename image_view_type::pixel_type>::has_alpha == false, "Images with alpha channel not supported");
const point pp(p); // Interpolation currently supports only fully cartesian (non-polar) spaces.
static_assert(is_color_space_cartesian_image<image_view_type>::value == true, "Non-cartesian color space used in interpolation");
// if the interpolation goes outside img
if (!get_rect(img).contains(grow_rect(pp,1)))
return false;
const long r = pp.y();
const long c = pp.x();
const double temp = interpolate(p-pp, using traits = pixel_traits<typename image_view_type::pixel_type>;
img[r-1][c-1],
img[r-1][c ],
img[r-1][c+1],
img[r ][c-1],
img[r ][c ],
img[r ][c+1],
img[r+1][c-1],
img[r+1][c ],
img[r+1][c+1]);
assign_pixel(result, temp);
return true;
}
template <typename T, typename image_view_type, typename pixel_type>
typename enable_if<is_rgb_image<image_view_type>,bool>::type operator() (
const image_view_type& img,
const dlib::vector<T,2>& p,
pixel_type& result
) const
{
COMPILE_TIME_ASSERT(pixel_traits<typename image_view_type::pixel_type>::has_alpha == false);
const point pp(p); const point pp(p);
// if the interpolation goes outside img // if the interpolation goes outside img
if (!get_rect(img).contains(grow_rect(pp,1))) if (!get_rect(img).contains(grow_rect(pp,1)))
return false; return false;
const long r = pp.y(); const long r = pp.y();
const long c = pp.x(); const long c = pp.x();
const double red = interpolate(p-pp, matrix<double, traits::num, 1> pvout;
img[r-1][c-1].red, for (long i = 0; i < traits::num; ++i)
img[r-1][c ].red, pvout(i) = interpolate(p-pp,
img[r-1][c+1].red, pixel_to_vector<double>(img[r-1][c-1])(i),
img[r ][c-1].red, pixel_to_vector<double>(img[r-1][c ])(i),
img[r ][c ].red, pixel_to_vector<double>(img[r-1][c+1])(i),
img[r ][c+1].red, pixel_to_vector<double>(img[r ][c-1])(i),
img[r+1][c-1].red, pixel_to_vector<double>(img[r ][c ])(i),
img[r+1][c ].red, pixel_to_vector<double>(img[r ][c+1])(i),
img[r+1][c+1].red); pixel_to_vector<double>(img[r+1][c-1])(i),
const double green = interpolate(p-pp, pixel_to_vector<double>(img[r+1][c ])(i),
img[r-1][c-1].green, pixel_to_vector<double>(img[r+1][c+1])(i));
img[r-1][c ].green, typename image_view_type::pixel_type temp;
img[r-1][c+1].green, vector_to_pixel(temp, pvout);
img[r ][c-1].green,
img[r ][c ].green,
img[r ][c+1].green,
img[r+1][c-1].green,
img[r+1][c ].green,
img[r+1][c+1].green);
const double blue = interpolate(p-pp,
img[r-1][c-1].blue,
img[r-1][c ].blue,
img[r-1][c+1].blue,
img[r ][c-1].blue,
img[r ][c ].blue,
img[r ][c+1].blue,
img[r+1][c-1].blue,
img[r+1][c ].blue,
img[r+1][c+1].blue);
rgb_pixel temp;
assign_pixel(temp.red, red);
assign_pixel(temp.green, green);
assign_pixel(temp.blue, blue);
assign_pixel(result, temp); assign_pixel(result, temp);
return true; return true;
} }
......
...@@ -78,14 +78,13 @@ namespace dlib ...@@ -78,14 +78,13 @@ namespace dlib
- image_view_type == an image_view or const_image_view object - image_view_type == an image_view or const_image_view object
- pixel_traits<typename image_view_type::pixel_type>::has_alpha == false - pixel_traits<typename image_view_type::pixel_type>::has_alpha == false
- pixel_traits<pixel_type> is defined - pixel_traits<pixel_type> is defined
- pixel_type uses cartesian coordinates color space
ensures ensures
- if (there is an interpolatable image location at point p in img) then - if (there is an interpolatable image location at point p in img) then
- #result == the interpolated pixel value from img at point p. - #result == the interpolated pixel value from img at point p.
- assign_pixel() will be used to write to #result, therefore any - assign_pixel() will be used to write to #result, therefore any
necessary color space conversion will be performed. necessary color space conversion will be performed.
- returns true - returns true
- if img contains RGB pixels then the interpolation will be in color.
Otherwise, the interpolation will be performed in a grayscale mode.
- else - else
- returns false - returns false
!*/ !*/
...@@ -119,14 +118,13 @@ namespace dlib ...@@ -119,14 +118,13 @@ namespace dlib
- image_view_type == an image_view or const_image_view object. - image_view_type == an image_view or const_image_view object.
- pixel_traits<typename image_view_type::pixel_type>::has_alpha == false - pixel_traits<typename image_view_type::pixel_type>::has_alpha == false
- pixel_traits<pixel_type> is defined - pixel_traits<pixel_type> is defined
- pixel_type uses cartesian coordinates color space
ensures ensures
- if (there is an interpolatable image location at point p in img) then - if (there is an interpolatable image location at point p in img) then
- #result == the interpolated pixel value from img at point p - #result == the interpolated pixel value from img at point p
- assign_pixel() will be used to write to #result, therefore any - assign_pixel() will be used to write to #result, therefore any
necessary color space conversion will be performed. necessary color space conversion will be performed.
- returns true - returns true
- if img contains RGB pixels then the interpolation will be in color.
Otherwise, the interpolation will be performed in a grayscale mode.
- else - else
- returns false - returns false
!*/ !*/
......
...@@ -132,6 +132,12 @@ namespace dlib ...@@ -132,6 +132,12 @@ namespace dlib
&& this->green == that.green && this->green == that.green
&& this->blue == that.blue; && this->blue == that.blue;
} }
bool operator != (const rgb_pixel& that) const
{
return !(*this == that);
}
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -165,6 +171,12 @@ namespace dlib ...@@ -165,6 +171,12 @@ namespace dlib
&& this->green == that.green && this->green == that.green
&& this->red == that.red; && this->red == that.red;
} }
bool operator != (const bgr_pixel& that) const
{
return !(*this == that);
}
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -199,6 +211,12 @@ namespace dlib ...@@ -199,6 +211,12 @@ namespace dlib
&& this->blue == that.blue && this->blue == that.blue
&& this->alpha == that.alpha; && this->alpha == that.alpha;
} }
bool operator != (const rgb_alpha_pixel& that) const
{
return !(*this == that);
}
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -229,7 +247,14 @@ namespace dlib ...@@ -229,7 +247,14 @@ namespace dlib
&& this->s == that.s && this->s == that.s
&& this->i == that.i; && this->i == that.i;
} }
bool operator != (const hsi_pixel& that) const
{
return !(*this == that);
}
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
struct lab_pixel struct lab_pixel
...@@ -258,7 +283,13 @@ namespace dlib ...@@ -258,7 +283,13 @@ namespace dlib
&& this->a == that.a && this->a == that.a
&& this->b == that.b; && this->b == that.b;
} }
};
bool operator != (const lab_pixel& that) const
{
return !(*this == that);
}
};
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
...@@ -1987,6 +1987,258 @@ namespace ...@@ -1987,6 +1987,258 @@ namespace
} }
} }
template<typename interpolation_type = interpolate_bilinear>
void test_resize_image_with_interpolation()
{
{
matrix<unsigned char> img_s(2, 2);
matrix<unsigned char> img_d(3, 3);
img_s(0, 0) = 0;
img_s(0, 1) = 100;
img_s(1, 0) = 100;
img_s(1, 1) = 100;
resize_image(img_s, img_d, interpolation_type());
DLIB_TEST((img_d(0, 0) == 0));
DLIB_TEST((img_d(0, 1) == 50));
DLIB_TEST((img_d(1, 2) == 100));
DLIB_TEST((img_d(2, 2) == 100));
}
{
matrix<rgb_pixel> img_s(2, 2);
matrix<rgb_pixel> img_d(3, 3);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 10, 20, 30 };
img_s(1, 0) = { 10, 20, 30 };
img_s(1, 1) = { 10, 20, 30 };
resize_image(img_s, img_d, interpolation_type());
DLIB_TEST((img_d(0, 0) == rgb_pixel{ 0, 0, 0 }));
DLIB_TEST((img_d(0, 1) == rgb_pixel{ 5, 10, 15 }));
DLIB_TEST((img_d(1, 2) == rgb_pixel{ 10, 20, 30 }));
DLIB_TEST((img_d(2, 2) == rgb_pixel{ 10, 20, 30 }));
}
{
matrix<lab_pixel> img_s(2, 2);
matrix<lab_pixel> img_d(3, 3);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 100, 20, 30 };
img_s(1, 0) = { 100, 20, 30 };
img_s(1, 1) = { 100, 20, 30 };
resize_image(img_s, img_d, interpolation_type());
DLIB_TEST((img_d(0, 0) == lab_pixel{ 0, 0, 0 }));
DLIB_TEST((img_d(0, 1) == lab_pixel{ 50, 10, 15 }));
DLIB_TEST((img_d(1, 2) == lab_pixel{ 100, 20, 30 }));
DLIB_TEST((img_d(2, 2) == lab_pixel{ 100, 20, 30 }));
}
}
void test_null_rotate_image_with_interpolation()
{
{
matrix<unsigned char> img_s(3, 3);
matrix<unsigned char> img_d;
img_s(0, 0) = 0;
img_s(0, 1) = 100;
img_s(0, 2) = 100;
img_s(1, 0) = 100;
img_s(1, 1) = 100;
img_s(1, 2) = 100;
img_s(2, 0) = 100;
img_s(2, 1) = 100;
img_s(2, 2) = 100;
rotate_image(img_s, img_d, 0, interpolate_bilinear());
DLIB_TEST((img_d(0, 0) == 0));
DLIB_TEST((img_d(0, 1) == 100));
DLIB_TEST((img_d(1, 0) == 100));
DLIB_TEST((img_d(1, 1) == 100));
}
{
matrix<rgb_pixel> img_s(3, 3);
matrix<rgb_pixel> img_d(3, 3);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 10, 20, 30 };
img_s(0, 2) = { 10, 20, 30 };
img_s(1, 0) = { 10, 20, 30 };
img_s(1, 1) = { 10, 20, 30 };
img_s(1, 2) = { 10, 20, 30 };
img_s(2, 0) = { 10, 20, 30 };
img_s(2, 1) = { 10, 20, 30 };
img_s(2, 2) = { 10, 20, 30 };
rotate_image(img_s, img_d, 0, interpolate_bilinear());
DLIB_TEST((img_d(0, 0) == rgb_pixel{ 0, 0, 0 }));
DLIB_TEST((img_d(0, 1) == rgb_pixel{ 10, 20, 30 }));
DLIB_TEST((img_d(1, 0) == rgb_pixel{ 10, 20, 30 }));
DLIB_TEST((img_d(1, 1) == rgb_pixel{ 10, 20, 30 }));
}
{
matrix<lab_pixel> img_s(3, 3);
matrix<lab_pixel> img_d(3, 3);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 100, 20, 30 };
img_s(0, 2) = { 100, 20, 30 };
img_s(1, 0) = { 100, 20, 30 };
img_s(1, 1) = { 100, 20, 30 };
img_s(1, 2) = { 100, 20, 30 };
img_s(2, 0) = { 100, 20, 30 };
img_s(2, 1) = { 100, 20, 30 };
img_s(2, 2) = { 100, 20, 30 };
rotate_image(img_s, img_d, 0, interpolate_bilinear());
DLIB_TEST((img_d(0, 0) == lab_pixel{ 0, 0, 0 }));
DLIB_TEST((img_d(0, 1) == lab_pixel{ 100, 20, 30 }));
DLIB_TEST((img_d(1, 0) == lab_pixel{ 100, 20, 30 }));
DLIB_TEST((img_d(1, 1) == lab_pixel{ 100, 20, 30 }));
}
}
void test_null_rotate_image_with_interpolation_quadratic()
{
{
matrix<unsigned char> img_s(3, 3);
matrix<unsigned char> img_d;
img_s(0, 0) = 0;
img_s(0, 1) = 100;
img_s(0, 2) = 100;
img_s(1, 0) = 100;
img_s(1, 1) = 100;
img_s(1, 2) = 100;
img_s(2, 0) = 100;
img_s(2, 1) = 100;
img_s(2, 2) = 100;
rotate_image(img_s, img_d, 0, interpolate_quadratic());
DLIB_TEST((img_d(1, 1) == 111));
}
{
matrix<rgb_pixel> img_s(3, 3);
matrix<rgb_pixel> img_d(3, 3);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 10, 20, 30 };
img_s(0, 2) = { 10, 20, 30 };
img_s(1, 0) = { 10, 20, 30 };
img_s(1, 1) = { 10, 20, 30 };
img_s(1, 2) = { 10, 20, 30 };
img_s(2, 0) = { 10, 20, 30 };
img_s(2, 1) = { 10, 20, 30 };
img_s(2, 2) = { 10, 20, 30 };
rotate_image(img_s, img_d, 0, interpolate_quadratic());
DLIB_TEST((img_d(1, 1) == rgb_pixel{ 11, 22, 33 }));
}
{
matrix<lab_pixel> img_s(3, 3);
matrix<lab_pixel> img_d(3, 3);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 100, 20, 30 };
img_s(0, 2) = { 100, 20, 30 };
img_s(1, 0) = { 100, 20, 30 };
img_s(1, 1) = { 100, 20, 30 };
img_s(1, 2) = { 100, 20, 30 };
img_s(2, 0) = { 100, 20, 30 };
img_s(2, 1) = { 100, 20, 30 };
img_s(2, 2) = { 100, 20, 30 };
rotate_image(img_s, img_d, 0, interpolate_quadratic());
DLIB_TEST((img_d(1, 1) == lab_pixel{ 111, 22, 33 }));
}
}
void test_interpolate_bilinear()
{
{
matrix<unsigned char> img_s(2, 2);
img_s(0, 0) = 0;
img_s(0, 1) = 100;
img_s(1, 0) = 100;
img_s(1, 1) = 100;
const_image_view<matrix<unsigned char>> imgv(img_s);
unsigned char result;
{
interpolate_bilinear()(imgv, dlib::vector<double, 2>{ 0.5, 0.0 }, result);
DLIB_TEST(result == 50);
}
{
interpolate_bilinear()(imgv, dlib::vector<double, 2>{ 0.5, 0.5 }, result);
DLIB_TEST(result == 75);
}
}
{
matrix<rgb_pixel> img_s(2, 2);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 10, 20, 30 };
img_s(1, 0) = { 10, 20, 30 };
img_s(1, 1) = { 10, 20, 30 };
const_image_view<matrix<rgb_pixel>> imgv(img_s);
rgb_pixel result;
{
interpolate_bilinear()(imgv, dlib::vector<double, 2>{ 0.5, 0.0 }, result);
DLIB_TEST(result.red == 5);
DLIB_TEST(result.green == 10);
DLIB_TEST(result.blue == 15);
}
{
interpolate_bilinear()(imgv, dlib::vector<double, 2>{ 0.5, 0.5 }, result);
DLIB_TEST(result.red == 7);
DLIB_TEST(result.green == 15);
DLIB_TEST(result.blue == 22);
}
}
{
matrix<lab_pixel> img_s(2, 2);
img_s(0, 0) = { 0, 0, 0 };
img_s(0, 1) = { 100, 20, 30 };
img_s(1, 0) = { 100, 20, 30 };
img_s(1, 1) = { 100, 20, 30 };
const_image_view<matrix<lab_pixel>> imgv(img_s);
lab_pixel result;
{
interpolate_bilinear()(imgv, dlib::vector<double, 2>{ 0.5, 0.0 }, result);
DLIB_TEST(result.l == 50);
DLIB_TEST(result.a == 10);
DLIB_TEST(result.b == 15);
}
{
interpolate_bilinear()(imgv, dlib::vector<double, 2>{ 0.5, 0.5 }, result);
DLIB_TEST(result.l == 75);
DLIB_TEST(result.a == 15);
DLIB_TEST(result.b == 22);
}
}
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
class image_tester : public tester class image_tester : public tester
...@@ -2086,6 +2338,10 @@ namespace ...@@ -2086,6 +2338,10 @@ namespace
} }
test_partition_pixels(); test_partition_pixels();
test_resize_image_with_interpolation<interpolate_bilinear>();
test_null_rotate_image_with_interpolation();
test_null_rotate_image_with_interpolation_quadratic();
test_interpolate_bilinear();
} }
} a; } a;
......
...@@ -15,28 +15,6 @@ ...@@ -15,28 +15,6 @@
#include "tester.h" #include "tester.h"
namespace dlib
{
static bool operator!=(const rgb_pixel& a, const rgb_pixel& b)
{
return !(a.red==b.red && a.green==b.green && a.blue==b.blue);
}
static bool operator!=(const bgr_pixel& a, const bgr_pixel& b)
{
return !(a.red==b.red && a.green==b.green && a.blue==b.blue);
}
static bool operator!=(const hsi_pixel& a, const hsi_pixel& b)
{
return !(a.h==b.h && a.s==b.s && a.i==b.i);
}
static bool operator!=(const rgb_alpha_pixel& a, const rgb_alpha_pixel& b)
{
return !(a.red==b.red && a.green==b.green && a.blue==b.blue && a.alpha==b.alpha);
}
}
namespace namespace
{ {
......
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