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

Made random_cropper's API a little more convenient for cropping out only

background crops.
parent be826990
...@@ -50,7 +50,7 @@ namespace dlib ...@@ -50,7 +50,7 @@ namespace dlib
double value double value
) )
{ {
DLIB_CASSERT(0 <= value && value < 1); DLIB_CASSERT(0 <= value && value <= 1);
background_crops_fraction = value; background_crops_fraction = value;
} }
...@@ -162,6 +162,19 @@ namespace dlib ...@@ -162,6 +162,19 @@ namespace dlib
(*this)(images[idx], rects[idx], crop, crop_rects); (*this)(images[idx], rects[idx], crop, crop_rects);
} }
template <
typename image_type1
>
image_type1 operator() (
const image_type1& img
)
{
image_type1 crop;
std::vector<mmod_rect> junk1, junk2;
(*this)(img, junk1, crop, junk2);
return crop;
}
template < template <
typename image_type1, typename image_type1,
typename image_type2 typename image_type2
......
...@@ -83,7 +83,7 @@ namespace dlib ...@@ -83,7 +83,7 @@ namespace dlib
); );
/*! /*!
requires requires
- 0 <= value < 1 - 0 <= value <= 1
ensures ensures
- #get_background_crops_fraction() == value - #get_background_crops_fraction() == value
!*/ !*/
...@@ -307,6 +307,23 @@ namespace dlib ...@@ -307,6 +307,23 @@ namespace dlib
inside the crop. inside the crop.
- #crop_rects.size() <= rects.size() - #crop_rects.size() <= rects.size()
!*/ !*/
template <
typename image_type1
>
image_type1 operator() (
const image_type1& img
);
/*!
requires
- img.size() != 0
- image_type1 == an image object that implements the interface defined in
dlib/image_processing/generic_image.h
ensures
- This function simply calls (*this)(img, junk1, crop, junk2) and returns
crop. Therefore it is simply a convenience function for extracting a
random background patch.
!*/
}; };
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
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