2D-D scheme for image mirroring and rotation Do yeon Kim and K. R. Rao Department of Electrical Engineering he University of eas at Arlington 46 Yates treet, 769, UA E-mail: cooldnk@yahoo.com, rao@uta.edu Abstract. Mirroring an image (horizontally or vertically) and rotation by 9, 8 and 27 in the spatial domain has been implemented by changing the signs of the 2D-DC coefficients of the original image appropriately. his approach leads to an efficient compressed domain-based image mirroring and rotation. his technique is now etended to 2D-D, i.e., 2D-D has properties similar to 2D- DC and can be applied to image mirroring (horizontally or vertically) and also rotation by 9, 8 and 27. We illustrate these methods in video editing application. Introduction Image or video coding standards like JPEG, MPEG-,2,4 and latest H.264 utilize DC or integer DC to compress image or video data. We can compress images to save storage space or transmit and then edit in the compressed-domain. Compressed-domain image manipulation has been introduced by mith and Rowe 2. By using the linearity of the DC, video dissolve and caption insert were processed in the compressed domain. Chang and Messerschmitt 3 introduced a method to reconstruct DC block using neighboring
four DC blocks in the compressed domain based on the fact that the DC is distributive to matri multiplication. Merhav and Bhaskaran 4 introduced fast DC-domain bilinear interpolation and motion compensation. hen, ethi and Bhaskaran 5 introduced logotype insertion in the compressed video. hey showed that DC-domain convolution which corresponds to multiplication in the spatial domain is more efficient because of the orthogonality of the DC. As an etension of these studies, a discrete cosine transform (DC)-domain image flipping scheme has been introduced. 6 We present a similar discrete sine transform (D)-domain 7,8 image mirroring and rotation scheme in this paper. 2 Proposed Algorithm By changing the signs of the D (discrete sine transform) coefficients, we can change the order of input sequence elements into the reverse order in the time domain. In other words, let { (), ( 2),, ( )} be the D coefficients of a sequence, { ( ), ( 2),, ( )}. Change the signs of the D coefficients as follows, { (), ( 2), (), 3, ( )}. he inverse D of the latter is { y ( n) } { ( ), ( 4), ( 2),, ( 2), ()} which has elements in reverse order. his can be proved as follows. For a sequence, (n) for n, 2,,, the D ype I and its inverse 7 are defined as follows: n ( m) ( n) 2 mnπ ( n)sin n 2 mnπ ( m)sin m m, 2,, () n, 2,,. (2) 2
From Eq. (2) we can recover the sequence { ( n) } as follows: 2 π 2π 3π ) () sin + (2) sin + (3) sin + ( (3) 2 2π 4π 6π 2) () sin + (2) sin + (3) sin + ( (4) n 2 ( ) () sin π + (2) sin 2π + (3) sin 3π + (4) sin 4π + 2 π 2π 3π () sin (2) sin + (3) sin 4π (4) sin +. (5) (6) Let Y(m) for m, 2,, be the D coefficients of y(n) for n, 2,,, and be related to (m) for m, 2,, as follows: Y ( 2k ) (2k ) (7) Y( 2k) (2k) (8) for k, 2,, ( ) 2 sequence of { ( n) }, i.e., n. he sequence y(n) for n, 2,, is the mirror 2 π 2π 3π y() () sin (2) sin + (3) sin 4π (4) sin + ( ) (9) 3
2 2 2 y( 2) () sin (2) sin 2 π π 2 2 + (3) sin 3π (4) sin 4π + (2) () 2 y( ) () sin (2) sin 2 π π + (3) sin 3π (4) sin 4π + (). () { y ( n)} { ( ), ( 2), n, ( 2), ( )} is { ( n) } in reverse order. n 3 Etension to the wo-d Case Mirroring and rotation of an image is illustrated using a (4 4) block. Given [] 2 3 4 2 22 32 42 3 23 33 43 4 24 34 44 Horizontally mirrored sequence of [ ] is 4 3 2 24 23 22 2. h 34 33 32 3 44 43 42 4 [ ] Vertically mirrored sequence of [ ] is 4 42 43 44 3 32 33 34 [ v ]. 2 22 23 24 2 3 4 4
[] rotated by 9 o is 4 3 2 42 32 22 2 9 O. 43 33 23 3 44 34 24 4 [ ] [] rotated by 8 o is 44 43 42 4 34 33 32 3 [ ]. 8 O 24 23 22 2 4 3 2 [] rotated by 27 o is [ O ] 27 4 3 2 hen [ O ] by 24 23 22 2 { } 34 33 32 3 44 43 42 4. 9 h [], where h {} denotes horizontal flipping an input matri and is defined [ h ] h{ [ ] } [][] J (2) where [ J ] O O is the opposite diagonal unit matri. Here the superscript represents transpose. Image can be represented as nonoverlapping blocks of size ( ) ( ) eample 8 (for ). Each block can be represented as a matri [ ] 8 D is defined in matri form as [ ] 8 where { s( m, n )} m, n { ( n, n2)} n, n2. he 5
s m, n ) 2 9 sin( n m 9). (3) ( π hen we can compute the two-dimensional D coefficients matri [ ] of an input image block or matri, [ ] as follows: [ ] [ ][ ][ ]. (4) Let the 2D-D of horizontally mirrored sequence [ h ] be [ H ] and the 2D-D of vertically mirrored sequence [ v ] be [ ]. hen we can compute [ H ] and [ ] follows: [ ] [ ][ M ] V as H (5) V [ V ] [ M ][ ] (6) where the matri [ M ] is defined as [ M ]. (7) hus we can select a group of consecutive 2D-D blocks of an image and flip horizontally according to the following steps:. Apply the (8 8) 2D-D to the nonoverlapping blocks of size (8 8) of the image. 2. et the size of a rectangular block to be horizontally flipped. Horizontal and vertical sizes should be multiples of eight according to the D size. 3. Compute D-domain image flipping for each 2D-D block by using Eq. (5). 6
7 4. Rotate horizontally D blocks within the rectangular block. he most left D block goes to the most right, and vice versa. In general this is applicable to ( ) ( ) [ ] 2D-D where 5, 9, 7, We can also rotate an image block by 9 in the 2D-D domain by using the proposed scheme. Let us denote the 2D-D of the 9, 8 and 27 rotated blocks in the spatial domain [ ] o 9, [ ] o 8 and [ ] o 27 as [ ] o 9, [ ] o 8 and [ ] o 27 respectively. hen we can compute 2D-D of rotated blocks in the spatial domain as follows: [ ] [ ][ ] [ ][ ] [ ][ ] [ ][ ] M J o 9 [ ] [ ] [ ] V M. (8) Let the symbol represent element-by-element multiplication. [ ] [ ][ ][ ] [ ] [ ] W M M o 8 (9) where the matri [ ] W is defined as [ ] W. (2) imilarly, [ ] [ ][ ][ ] [ ] [ ][ ][ ] [ ] M J o 27 [ ][ ] [ ] H M. (2)
We can also show Eqs. (9) and (2) by using [ ] [ ] indicates forward and inverse 2D-D pair., where the symbol 4 imulations Using Eqs. (5)-(2), the 2D-D domain manipulation is utilized to obtain image mirroring and rotation by 9, 8, and 27 in spatial domain. ote that image mirroring and rotation by 9, 8, and 27 in spatial domain is accomplished by changing the signs of the 2D-D coefficients of the original image appropriately. ee Eqs. (5)-(2). hese operations are implemented on images Lena (Fig. ) and Boat (Fig. 2). 5 Compleity Comparison Image or video coding standards like JPEG, MPEG-,2,4 and H.264 utilize DC and integer DC to compress image or video data. We can compress images to save storage space or transmit and then edit in the compressed-domain. In that case, the DC-domain image mirroring scheme 6 is very efficient compared to the eisting method, which does the IDC and flipping operation and then the DC. he technique developed 6 does not need any multiplications and only needs to change signs of the DC coefficients. imilarly by changing the signs of the 2D-D coefficients, mirroring and rotation of the images are accomplished. 8
6 Conclusions Image or video coding systems can utilize D to compress image or video data. By using the proposed scheme, we can flip images horizontally and/or vertically in the spatial domain by appropriately changing the signs of the 2D-D coefficients. he proposed scheme is very efficient compared to the eisting method, which does the 2D- ID, flipping operation in the spatial domain and then the 2D-D, since the D/ID need multiplications. We also showed efficient compressed-domain scheme for rotation of images by 9, 8, and 27 in the spatial domain. Acknowledgments Do yeon Kim acknowledges the support by the Korea Ministry of Information and Communication. References.-K. Kwon, A. amhankar, and K. R. Rao, "Overview of H.264/MPEG-4 Part ", J. Vis. Commun. and Image Representation, 7, 86-26, April (26). 2 B. C. mith and L. A. Rowe, Algorithms for manipulating compressed images, IEEE Computer Graphics & Applications, 3(5), 34-42 (993). 3.-F. Chang and D. G. Messerschmitt, Manipulation and compositing of MC-DC compressed video, IEEE J. elect. Areas Commun. 3(), - (995). 9
4. Merhav and V. Bhaskaran, Fast algorithms for DC-domain image down sampling and for inverse motion compensation, IEEE rans. Circuits yst. Video echnol. 7(3), 468-476 (997). 5 B. hen, I. K. ethi, and V. Bhaskaran, DC convolution and its application in compressed domain, IEEE rans. Circuits yst. Video echnol. 8(8), 947-952 (998). 6 B. hen and I. K. ethi, Inner-block operations on compressed images, in the hird ACM International Conference on Multimedia, Proc., an Francisco, CA, 489-498, (995). 7 P. Yip and K. R. Rao, A fast computational algorithm for the discrete sine transform, IEEE rans. Commun. 28(2), 34-37 (98). 8 V. Britanak, P. Yip, and K. R. Rao, Discrete Cosine and ine ransforms, Academic Press (Elsevier), Orlando, FL (27).
(a) (c) (d) (b) (e) Fig. Mirroring or rotation of portion of Lena image in the spatial domain by manipulating the 2D-D coefficients of the original block: (a) horizontal mirroring, (b) vertical mirroring, (c) rotation by 9, (d) rotation by 8, and (e) rotation by 27.
(a) (c) (b) (d) (e) (g) (f) Fig. 2 Mirroring or rotation of portion of Boat image in the spatial domain by manipulating the 2D-D coefficients of the original block: (a) translation, (b) horizontal mirroring of (a), (c) vertical mirroring of (a), (d) translation, (e) rotation of (d) by 9, (f) rotation of (d) by 8, and (g) rotation of (d) by 27. 2