Made the disabled version of pyramid_down support the new image interface.

Also added an overload of operator() for pyramid_down that takes just
a single image and downsamples it.
This commit is contained in:
Davis King 2014-07-20 08:07:59 -04:00
parent 0eb725fc4f
commit 6d55fcc260
2 changed files with 66 additions and 1 deletions

View File

@ -124,7 +124,19 @@ namespace dlib
COMPILE_TIME_ASSERT( pixel_traits<in_pixel_type>::has_alpha == false );
COMPILE_TIME_ASSERT( pixel_traits<out_pixel_type>::has_alpha == false );
down.clear();
set_image_size(down, 0, 0);
}
template <
typename image_type
>
void operator() (
image_type& img
) const
{
typedef typename image_traits<image_type>::pixel_type pixel_type;
COMPILE_TIME_ASSERT( pixel_traits<pixel_type>::has_alpha == false );
set_image_size(img, 0, 0);
}
};
@ -454,6 +466,18 @@ namespace dlib
}
template <
typename image_type
>
void operator() (
image_type& img
) const
{
image_type temp;
(*this)(img, temp);
swap(temp, img);
}
private:
@ -788,6 +812,17 @@ namespace dlib
}
}
template <
typename image_type
>
void operator() (
image_type& img
) const
{
image_type temp;
(*this)(img, temp);
swap(temp, img);
}
private:
@ -911,6 +946,18 @@ namespace dlib
set_image_size(down, ((N-1)*num_rows(original))/N, ((N-1)*num_columns(original))/N);
resize_image(original, down);
}
template <
typename image_type
>
void operator() (
image_type& img
) const
{
image_type temp;
(*this)(img, temp);
swap(temp, img);
}
};
template <>

View File

@ -64,6 +64,24 @@ namespace dlib
points outside the #down image.
!*/
template <
typename image_type
>
void operator() (
image_type& img
) const;
/*!
requires
- image_type == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
- pixel_traits<typename image_traits<image_type>::pixel_type>::has_alpha == false
ensures
- This function downsamples the given image and stores the results in #img.
In particular, it is equivalent to performing:
(*this)(img, temp);
swap(img, temp);
!*/
// -------------------------------
template <typename T>