mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added an overload of upsample_image_dataset() for mmod_rect annotated datasets.
This commit is contained in:
parent
70619d2fd6
commit
9e290dce34
@ -1275,6 +1275,36 @@ namespace dlib
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename pyramid_type,
|
||||
typename image_array_type
|
||||
>
|
||||
void upsample_image_dataset (
|
||||
image_array_type& images,
|
||||
std::vector<std::vector<mmod_rect>>& objects
|
||||
)
|
||||
{
|
||||
// make sure requires clause is not broken
|
||||
DLIB_ASSERT( images.size() == objects.size(),
|
||||
"\t void upsample_image_dataset()"
|
||||
<< "\n\t Invalid inputs were given to this function."
|
||||
<< "\n\t images.size(): " << images.size()
|
||||
<< "\n\t objects.size(): " << objects.size()
|
||||
);
|
||||
|
||||
typename image_array_type::value_type temp;
|
||||
pyramid_type pyr;
|
||||
for (unsigned long i = 0; i < images.size(); ++i)
|
||||
{
|
||||
pyramid_up(images[i], temp, pyr);
|
||||
swap(temp, images[i]);
|
||||
for (unsigned long j = 0; j < objects[i].size(); ++j)
|
||||
{
|
||||
objects[i][j].rect = pyr.rect_up(objects[i][j].rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <
|
||||
typename pyramid_type,
|
||||
typename image_array_type
|
||||
|
@ -651,6 +651,33 @@ namespace dlib
|
||||
#objects[i].size() == objects[i].size()
|
||||
!*/
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
template <
|
||||
typename pyramid_type,
|
||||
typename image_array_type
|
||||
>
|
||||
void upsample_image_dataset (
|
||||
image_array_type& images,
|
||||
std::vector<std::vector<mmod_rect>>& objects
|
||||
);
|
||||
/*!
|
||||
requires
|
||||
- image_array_type == a dlib::array or std::vector of image objects that each
|
||||
implement the interface defined in dlib/image_processing/generic_image.h
|
||||
- images.size() == objects.size()
|
||||
ensures
|
||||
- This function replaces each image in images with an upsampled version of that
|
||||
image. Each image is upsampled using pyramid_up() and the given
|
||||
pyramid_type. Therefore, #images[i] will contain the larger upsampled
|
||||
version of images[i]. It also adjusts all the rectangles in objects so that
|
||||
they still bound the same visual objects in each image.
|
||||
- #images.size() == image.size()
|
||||
- #objects.size() == objects.size()
|
||||
- for all valid i:
|
||||
#objects[i].size() == objects[i].size()
|
||||
!*/
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
||||
template <
|
||||
|
Loading…
Reference in New Issue
Block a user