Commit 40448e64 authored by Davis King's avatar Davis King

Made add_image_left_right_flips() and add_image_rotations() work with

mmod_rects in addition to rectangles and full_object_detections.
parent 44702809
...@@ -1163,6 +1163,15 @@ namespace dlib ...@@ -1163,6 +1163,15 @@ namespace dlib
return centered_rect(tran(center(rect)), rect.width(), rect.height()); return centered_rect(tran(center(rect)), rect.width(), rect.height());
} }
inline mmod_rect tform_object (
const point_transform_affine& tran,
mmod_rect rect
)
{
rect.rect = tform_object(tran, rect.rect);
return rect;
}
inline full_object_detection tform_object( inline full_object_detection tform_object(
const point_transform_affine& tran, const point_transform_affine& tran,
const full_object_detection& obj const full_object_detection& obj
...@@ -1209,7 +1218,7 @@ namespace dlib ...@@ -1209,7 +1218,7 @@ namespace dlib
for (unsigned long i = 0; i < objects[j].size(); ++i) for (unsigned long i = 0; i < objects[j].size(); ++i)
rects.push_back(impl::tform_object(tran, objects[j][i])); rects.push_back(impl::tform_object(tran, objects[j][i]));
images.push_back(temp); images.push_back(std::move(temp));
objects.push_back(rects); objects.push_back(rects);
} }
} }
...@@ -1245,7 +1254,7 @@ namespace dlib ...@@ -1245,7 +1254,7 @@ namespace dlib
for (unsigned long j = 0; j < num; ++j) for (unsigned long j = 0; j < num; ++j)
{ {
const point_transform_affine tran = flip_image_left_right(images[j], temp); const point_transform_affine tran = flip_image_left_right(images[j], temp);
images.push_back(temp); images.push_back(std::move(temp));
rects.clear(); rects.clear();
for (unsigned long i = 0; i < objects[j].size(); ++i) for (unsigned long i = 0; i < objects[j].size(); ++i)
...@@ -1544,7 +1553,7 @@ namespace dlib ...@@ -1544,7 +1553,7 @@ namespace dlib
for (unsigned long j = 0; j < images.size(); ++j) for (unsigned long j = 0; j < images.size(); ++j)
{ {
const point_transform_affine tran = rotate_image(images[j], temp, angles(i)); const point_transform_affine tran = rotate_image(images[j], temp, angles(i));
new_images.push_back(temp); new_images.push_back(std::move(temp));
objtemp.clear(); objtemp.clear();
for (unsigned long k = 0; k < objects[j].size(); ++k) for (unsigned long k = 0; k < objects[j].size(); ++k)
......
...@@ -499,7 +499,7 @@ namespace dlib ...@@ -499,7 +499,7 @@ namespace dlib
requires requires
- image_array_type == a dlib::array or std::vector of image objects that each - 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 implement the interface defined in dlib/image_processing/generic_image.h
- T == rectangle or full_object_detection - T == rectangle, full_object_detection, or mmod_rect
- images.size() == objects.size() - images.size() == objects.size()
ensures ensures
- This function computes all the left/right flips of the contents of images and - This function computes all the left/right flips of the contents of images and
...@@ -532,8 +532,8 @@ namespace dlib ...@@ -532,8 +532,8 @@ namespace dlib
implement the interface defined in dlib/image_processing/generic_image.h implement the interface defined in dlib/image_processing/generic_image.h
- images.size() == objects.size() - images.size() == objects.size()
- images.size() == objects2.size() - images.size() == objects2.size()
- T == rectangle or full_object_detection - T == rectangle, full_object_detection, or mmod_rect
- U == rectangle or full_object_detection - U == rectangle, full_object_detection, or mmod_rect
ensures ensures
- This function computes all the left/right flips of the contents of images and - This function computes all the left/right flips of the contents of images and
then appends them onto the end of the images array. It also finds the then appends them onto the end of the images array. It also finds the
...@@ -571,8 +571,8 @@ namespace dlib ...@@ -571,8 +571,8 @@ namespace dlib
- angles.size() > 0 - angles.size() > 0
- images.size() == objects.size() - images.size() == objects.size()
- images.size() == objects2.size() - images.size() == objects2.size()
- T == rectangle or full_object_detection - T == rectangle, full_object_detection, or mmod_rect
- U == rectangle or full_object_detection - U == rectangle, full_object_detection, or mmod_rect
ensures ensures
- This function computes angles.size() different rotations of all the given - This function computes angles.size() different rotations of all the given
images and then replaces the contents of images with those rotations of the images and then replaces the contents of images with those rotations of the
...@@ -608,7 +608,7 @@ namespace dlib ...@@ -608,7 +608,7 @@ namespace dlib
- is_vector(angles) == true - is_vector(angles) == true
- angles.size() > 0 - angles.size() > 0
- images.size() == objects.size() - images.size() == objects.size()
- T == rectangle or full_object_detection - T == rectangle, full_object_detection, or mmod_rect
ensures ensures
- This function is identical to the add_image_rotations() define above except - This function is identical to the add_image_rotations() define above except
that it doesn't have objects2 as an argument. that it doesn't have objects2 as an argument.
......
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