eece253 13 rotation
TRANSCRIPT
-
7/31/2019 EECE253 13 Rotation
1/21
EECE\CS 253 Image Processing
Richard Alan Peters II
Department of Electrical Engineering and
Computer Science
Fall Semester 2007
Lecture Notes
Lecture Notes: Rotating Images
This work is licensed under the Creative Commons Attribution-Noncommercial 2.5 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/2.5/ or
send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.
-
7/31/2019 EECE253 13 Rotation
2/21
6/25/2012 26/25/2012 21999-2007 by Richard Alan Peters II
Geometric Remapping
Input Image
Warping Function
Interpolation Function
Output Image
-
7/31/2019 EECE253 13 Rotation
3/21
-
7/31/2019 EECE253 13 Rotation
4/21
6/25/2012 46/25/2012 41999-2007 by Richard Alan Peters II
Image Rotation
Isize,,inin
BCR
2
in
2
inCRD
in
in1tan
C
RA
image size:
aspect angle:
length of diagonal:
-
7/31/2019 EECE253 13 Rotation
5/21
-
7/31/2019 EECE253 13 Rotation
6/21
6/25/2012 66/25/2012 61999-2007 by Richard Alan Peters II
Image Rotation
Compute the dimensionsof the output image:number of rows.
if 0 < 90.
,round sinDout AR
-
7/31/2019 EECE253 13 Rotation
7/21
6/25/2012 76/25/2012 71999-2007 by Richard Alan Peters II
Image Rotation
Compute the dimensionsof the output image:number of columns.
AC cosDroundout
if 0 < 90.
-
7/31/2019 EECE253 13 Rotation
8/21
6/25/2012 86/25/2012 81999-2007 by Richard Alan Peters II
Image Rotation
The output dimension calculation depends on the value of as follows:
If 0 < 90:
,round sinDout AR
.round cosDout AC
If90 < 0: ,round sinDout AR
.round cosDout AC
If 90 < 180:
,round 90cosDout AR
.round 90sinDout AC
If180
-
7/31/2019 EECE253 13 Rotation
9/21
6/25/2012 96/25/2012 91999-2007 by Richard Alan Peters II
Image Rotation
.1,1,
out21
out21
out0out0
CRCR
0out
0out
C
R
Allocate an outputimage with dimensions(Rout,Cout), where
1
AR sinDroundout
AC cosDroundout
and center point
1Rout and Cout below are valid for 0 < 90. Otherwise see slide 7.
-
7/31/2019 EECE253 13 Rotation
10/21
6/25/2012 106/25/2012 101999-2007 by Richard Alan Peters II
Image Rotation
0in
0in
0out
0out1
:,,
C
R
Cc
Rr
c
rcr
f
f
cossin
sincos
1
Work backward. Forevery output loc. (r,c)select an input loc. (rf,cf)by rotating (r,c) aroundthe image center by -.
0out
0out
C
R
-
7/31/2019 EECE253 13 Rotation
11/21
-
7/31/2019 EECE253 13 Rotation
12/21
6/25/2012 126/25/2012 121999-2007 by Richard Alan Peters II
Image Rotation
0in
0in
0out
0out1
:,,
C
R
Cc
Rr
c
rcr
f
f
After rotation by -,J(r,c) is in nearly thesame position asI(rf,cf).
-
7/31/2019 EECE253 13 Rotation
13/21
6/25/2012 136/25/2012 131999-2007 by Richard Alan Peters II
Image Rotation
0in
0in
0out
0out1
:,,
C
R
Cc
Rr
c
rcr
f
f
After rotation by -,J(r,c) is in nearly thesame position asI(rf,cf).
-
7/31/2019 EECE253 13 Rotation
14/21
6/25/2012 146/25/2012 141999-2007 by Richard Alan Peters II
Image Rotation
0in
0in
0out
0out1
:,,
C
R
Cc
Rr
c
rcr
f
f
After rotation by -,J(r,c) is in nearly thesame position asI(rf,cf).
-
7/31/2019 EECE253 13 Rotation
15/21
6/25/2012 156/25/2012 151999-2007 by Richard Alan Peters II
Image Rotation
.,I;,J ff crcr Interpolation:The output pixel value is(usually) a function of the
values on a neighborhood a set of pixels thatsurrounds (rf,cf).
Bilinear Interp. uses a 22neighborhood, bicubic
uses a 44.
Nearest neighbor is simply,J(r,c) = I(ri ,ci ) where(ri ,ci ) = round(rf,cf).
-
7/31/2019 EECE253 13 Rotation
16/21
6/25/2012 166/25/2012 161999-2007 by Richard Alan Peters II
Image Rotation with Interpolation
Original image: San Francisco financial district
-
7/31/2019 EECE253 13 Rotation
17/21
6/25/2012 176/25/2012 171999-2007 by Richard Alan Peters II
Image Rotation with Nearest Neighbor Interpolation
Bicubic Nearest Neighbor Nearest Neighbor Bilinear
-
7/31/2019 EECE253 13 Rotation
18/21
6/25/2012 186/25/2012 181999-2007 by Richard Alan Peters II
Image Rotation with Bilinear Interpolation
Nearest Neighbor Bilinear Bilinear Bicubic
-
7/31/2019 EECE253 13 Rotation
19/21
6/25/2012 196/25/2012 191999-2007 by Richard Alan Peters II
Image Rotation with Bicubic Interpolation
Bilinear Bicubic Bicubic Nearest Neighbor
-
7/31/2019 EECE253 13 Rotation
20/21
6/25/2012 206/25/2012 201999-2007 by Richard Alan Peters II
Example of Warping: Map Image to Sphere
0 out out1
min , .2
R C
out
out
0
2 2
out out
1
1
,
tan ,
sin .
r
c
r c
0 in in1
max , .2
d R C
20
in
in
sin
cos
d d
r d
c d
For each output pixel,
For the output image, For the input image,
For each output pixel,the input pixel loc is,
-
7/31/2019 EECE253 13 Rotation
21/21
6/25/2012 216/25/2012 211999-2007 by Richard Alan Peters II
Example of Warping: Map Image to Sphere
d: radial distancefrom center ofinput image.: same for
output image.