Commit 6aeead8f authored by Davis King's avatar Davis King

Removed all the various overloads of get_rect() and replaced them all

with a single generic template.  Not sure why I didn't do this a long
time ago.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%403340
parent 5bf92d48
...@@ -303,11 +303,6 @@ namespace dlib ...@@ -303,11 +303,6 @@ namespace dlib
} }
} }
template < typename T >
const rectangle get_rect (
const array2d_kernel_1<T>& item
) { return rectangle(0, 0, item.nc()-1, item.nr()-1); }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// member function definitions // member function definitions
......
...@@ -240,18 +240,6 @@ namespace dlib ...@@ -240,18 +240,6 @@ namespace dlib
provides deserialization support provides deserialization support
!*/ !*/
template <
typename T
>
const rectangle get_rect (
const array2d<T>& item
);
/*!
ensures
- returns rectangle(0, 0, item.nc()-1, item.nr()-1)
(i.e. returns a rectangle that has the same dimensions as
the array2d item)
!*/
} }
#endif // DLIB_ARRAY2D_KERNEl_ABSTRACT_ #endif // DLIB_ARRAY2D_KERNEl_ABSTRACT_
......
...@@ -200,11 +200,6 @@ namespace dlib ...@@ -200,11 +200,6 @@ namespace dlib
} }
} }
template < typename array2d_base >
const rectangle get_rect (
const array2d_kernel_c<array2d_base>& item
) { return rectangle(0, 0, item.nc()-1, item.nr()-1); }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
// member function definitions // member function definitions
......
...@@ -504,6 +504,18 @@ namespace dlib ...@@ -504,6 +504,18 @@ namespace dlib
return rectangle(x, y, x+rect.width()-1, y+rect.height()-1); return rectangle(x, y, x+rect.width()-1, y+rect.height()-1);
} }
// ----------------------------------------------------------------------------------------
template <
typename T
>
inline const rectangle get_rect (
const T& m
)
{
return rectangle(0, 0, m.nc()-1, m.nr()-1);
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
...@@ -606,6 +606,24 @@ namespace dlib ...@@ -606,6 +606,24 @@ namespace dlib
- returns the point in rect that is closest to p - returns the point in rect that is closest to p
!*/ !*/
// ----------------------------------------------------------------------------------------
template <
typename T
>
const rectangle get_rect (
const T& m
);
/*!
requires
- T has nr() and nc() functions that return longs
ensures
- returns rectangle(0, 0, m.nc()-1, m.nr()-1)
(i.e. assuming T represents some kind of rectangular grid, such as
the dlib::matrix or dlib::array2d objects, this function returns the
bounding rectangle for that gridded object.)
!*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
} }
......
...@@ -19,9 +19,6 @@ namespace dlib ...@@ -19,9 +19,6 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
class integral_image; class integral_image;
inline const rectangle get_rect (
const integral_image& img
);
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -106,15 +103,6 @@ namespace dlib ...@@ -106,15 +103,6 @@ namespace dlib
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
inline const rectangle get_rect (
const integral_image& img
)
{
return rectangle(0, 0, img.nc()-1, img.nr()-1);
}
// ----------------------------------------------------------------------------
template <typename integral_image_type> template <typename integral_image_type>
typename integral_image_type::value_type haar_x ( typename integral_image_type::value_type haar_x (
const integral_image_type& img, const integral_image_type& img,
......
...@@ -76,18 +76,6 @@ namespace dlib ...@@ -76,18 +76,6 @@ namespace dlib
}; };
// ----------------------------------------------------------------------------------------
const rectangle get_rect (
const integral_image& img
);
/*!
ensures
- returns rectangle(0, 0, img.nc()-1, img.nr()-1)
(i.e. returns a rectangle that has the same dimensions as
the integral_image img)
!*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template <typename integral_image_type> template <typename integral_image_type>
......
...@@ -57,18 +57,6 @@ namespace dlib ...@@ -57,18 +57,6 @@ namespace dlib
return matrix_range_exp<long>(start,inc,end); return matrix_range_exp<long>(start,inc,end);
} }
// ----------------------------------------------------------------------------------------
template <
typename EXP
>
const rectangle get_rect (
const matrix_exp<EXP>& m
)
{
return rectangle(0, 0, m.nc()-1, m.nr()-1);
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
......
...@@ -9,18 +9,6 @@ ...@@ -9,18 +9,6 @@
namespace dlib namespace dlib
{ {
// ----------------------------------------------------------------------------------------
const rectangle get_rect (
const matrix_exp& m
);
/*!
ensures
- returns rectangle(0, 0, m.nc()-1, m.nr()-1)
(i.e. returns a rectangle that has the same dimensions as
the matrix m)
!*/
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template <long start, long inc, long end> template <long start, long inc, long end>
......
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