Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
7742c575
Commit
7742c575
authored
Nov 13, 2013
by
Davis King
Browse files
Made rotate_image() return a transformation object that defines the point mapping
between the input and output images.
parent
478af745
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
11 deletions
+16
-11
dlib/image_transforms/interpolation.h
dlib/image_transforms/interpolation.h
+10
-9
dlib/image_transforms/interpolation_abstract.h
dlib/image_transforms/interpolation_abstract.h
+6
-2
No files found.
dlib/image_transforms/interpolation.h
View file @
7742c575
...
@@ -411,7 +411,7 @@ namespace dlib
...
@@ -411,7 +411,7 @@ namespace dlib
typename
image_type2
,
typename
image_type2
,
typename
interpolation_type
typename
interpolation_type
>
>
v
oi
d
rotate_image
(
p
oi
nt_transform_affine
rotate_image
(
const
image_type1
&
in_img
,
const
image_type1
&
in_img
,
image_type2
&
out_img
,
image_type2
&
out_img
,
double
angle
,
double
angle
,
...
@@ -420,7 +420,7 @@ namespace dlib
...
@@ -420,7 +420,7 @@ namespace dlib
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
"
\t
v
oi
d
rotate_image()"
"
\t
p
oi
nt_transform_affine
rotate_image()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
);
);
...
@@ -438,8 +438,9 @@ namespace dlib
...
@@ -438,8 +438,9 @@ namespace dlib
const
matrix
<
double
,
2
,
2
>
R
=
rotation_matrix
(
angle
);
const
matrix
<
double
,
2
,
2
>
R
=
rotation_matrix
(
angle
);
transform_image
(
in_img
,
out_img
,
interp
,
point_transform_affine
trans
=
point_transform_affine
(
R
,
-
R
*
dcenter
(
get_rect
(
out_img
))
+
dcenter
(
rimg
));
point_transform_affine
(
R
,
-
R
*
dcenter
(
get_rect
(
out_img
))
+
dcenter
(
rimg
)));
transform_image
(
in_img
,
out_img
,
interp
,
trans
);
return
trans
;
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -448,7 +449,7 @@ namespace dlib
...
@@ -448,7 +449,7 @@ namespace dlib
typename
image_type1
,
typename
image_type1
,
typename
image_type2
typename
image_type2
>
>
v
oi
d
rotate_image
(
p
oi
nt_transform_affine
rotate_image
(
const
image_type1
&
in_img
,
const
image_type1
&
in_img
,
image_type2
&
out_img
,
image_type2
&
out_img
,
double
angle
double
angle
...
@@ -456,12 +457,12 @@ namespace dlib
...
@@ -456,12 +457,12 @@ namespace dlib
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
"
\t
v
oi
d
rotate_image()"
"
\t
p
oi
nt_transform_affine
rotate_image()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
);
);
rotate_image
(
in_img
,
out_img
,
angle
,
interpolate_quadratic
());
return
rotate_image
(
in_img
,
out_img
,
angle
,
interpolate_quadratic
());
}
}
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -861,7 +862,7 @@ namespace dlib
...
@@ -861,7 +862,7 @@ namespace dlib
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
"
\t
void
rotate_image
()"
"
\t
void
flip_image_left_right
()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
);
);
...
@@ -882,7 +883,7 @@ namespace dlib
...
@@ -882,7 +883,7 @@ namespace dlib
{
{
// make sure requires clause is not broken
// make sure requires clause is not broken
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
DLIB_ASSERT
(
is_same_object
(
in_img
,
out_img
)
==
false
,
"
\t
void
rotate_image
()"
"
\t
void
flip_image_up_down
()"
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
Invalid inputs were given to this function."
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
<<
"
\n\t
is_same_object(in_img, out_img): "
<<
is_same_object
(
in_img
,
out_img
)
);
);
...
...
dlib/image_transforms/interpolation_abstract.h
View file @
7742c575
...
@@ -293,7 +293,7 @@ namespace dlib
...
@@ -293,7 +293,7 @@ namespace dlib
typename
image_type2
,
typename
image_type2
,
typename
interpolation_type
typename
interpolation_type
>
>
v
oi
d
rotate_image
(
p
oi
nt_transform_affine
rotate_image
(
const
image_type1
&
in_img
,
const
image_type1
&
in_img
,
image_type2
&
out_img
,
image_type2
&
out_img
,
double
angle
,
double
angle
,
...
@@ -312,6 +312,8 @@ namespace dlib
...
@@ -312,6 +312,8 @@ namespace dlib
- Parts of #out_img which have no corresponding locations in in_img are set to black.
- Parts of #out_img which have no corresponding locations in in_img are set to black.
- uses the supplied interpolation routine interp to perform the necessary
- uses the supplied interpolation routine interp to perform the necessary
pixel interpolation.
pixel interpolation.
- returns a transformation object that maps points in in_img into their corresponding
location in #out_img.
!*/
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
@@ -321,7 +323,7 @@ namespace dlib
...
@@ -321,7 +323,7 @@ namespace dlib
typename
image_type1
,
typename
image_type1
,
typename
image_type2
typename
image_type2
>
>
v
oi
d
rotate_image
(
p
oi
nt_transform_affine
rotate_image
(
const
image_type1
&
in_img
,
const
image_type1
&
in_img
,
image_type2
&
out_img
,
image_type2
&
out_img
,
double
angle
double
angle
...
@@ -338,6 +340,8 @@ namespace dlib
...
@@ -338,6 +340,8 @@ namespace dlib
The rotation is performed with respect to the center of the image.
The rotation is performed with respect to the center of the image.
- Parts of #out_img which have no corresponding locations in in_img are set to black.
- Parts of #out_img which have no corresponding locations in in_img are set to black.
- uses the interpolate_quadratic object to perform the necessary pixel interpolation.
- uses the interpolate_quadratic object to perform the necessary pixel interpolation.
- returns a transformation object that maps points in in_img into their corresponding
location in #out_img.
!*/
!*/
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment