Commit 3ecaaa0b authored by Davis King's avatar Davis King

- Made flip_image_left_right() return a point_transform_affine object that

  describes the exact transformation used.
- Fixed a bug in rotate_image(), it returned a point_transform_affine object
  that did the opposite of what the specification said it returns.
parent 4b4255d1
......@@ -441,7 +441,7 @@ namespace dlib
point_transform_affine trans = point_transform_affine(R, -R*dcenter(get_rect(out_img)) + dcenter(rimg));
transform_image(in_img, out_img, interp, trans);
return trans;
return inv(trans);
}
// ----------------------------------------------------------------------------------------
......@@ -858,7 +858,7 @@ namespace dlib
typename image_type1,
typename image_type2
>
void flip_image_left_right (
point_transform_affine flip_image_left_right (
const image_type1& in_img,
image_type2& out_img
)
......@@ -871,6 +871,13 @@ namespace dlib
);
assign_image(out_img, fliplr(mat(in_img)));
std::vector<dlib::vector<double,2> > from, to;
rectangle r = get_rect(in_img);
from.push_back(r.tl_corner()); to.push_back(r.tr_corner());
from.push_back(r.bl_corner()); to.push_back(r.br_corner());
from.push_back(r.tr_corner()); to.push_back(r.tl_corner());
from.push_back(r.br_corner()); to.push_back(r.bl_corner());
return find_affine_transform(from,to);
}
// ----------------------------------------------------------------------------------------
......@@ -1142,7 +1149,7 @@ namespace dlib
image_type temp;
for (unsigned long i = 0; i < images.size(); ++i)
{
const point_transform_affine tran = inv(rotate_image(images[i], temp, angle));
const point_transform_affine tran = rotate_image(images[i], temp, angle);
temp.swap(images[i]);
for (unsigned long j = 0; j < objects[i].size(); ++j)
{
......@@ -1173,7 +1180,7 @@ namespace dlib
image_type temp;
for (unsigned long i = 0; i < images.size(); ++i)
{
const point_transform_affine tran = inv(rotate_image(images[i], temp, angle));
const point_transform_affine tran = rotate_image(images[i], temp, angle);
temp.swap(images[i]);
for (unsigned long j = 0; j < objects[i].size(); ++j)
{
......
......@@ -406,7 +406,7 @@ namespace dlib
typename image_type1,
typename image_type2
>
void flip_image_left_right (
point_transform_affine flip_image_left_right (
const image_type1& in_img,
image_type2& out_img
);
......@@ -422,6 +422,8 @@ namespace dlib
- #out_img.nc() == in_img.nc()
- #out_img == a copy of in_img which has been flipped from left to right.
(i.e. it is flipped as if viewed though a mirror)
- returns a transformation object that maps points in in_img into their
corresponding location in #out_img.
!*/
// ----------------------------------------------------------------------------------------
......
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