An Ambigramic Image File Format
Total Page:16
File Type:pdf, Size:1020Kb
Global Journal of Computer Science and Technology: F Graphics & Vision Volume 21 Issue 1 Version 1.0 Year 2021 Type: Double Blind Peer Reviewed International Research Journal Publisher: Global Journals Online ISSN: 0975-4172 & Print ISSN: 0975-4350 An Ambigramic Image File Format By Wenyi Cui, Kohei Inoue & Kenji Hara Kyushu University Abstract- We propose an image file format that can be read in two ways, where two images are recorded in a single file as a bit sequence, and the forward reading the bit sequence makes one of the two images visible, or the backward reading makes another image visible. Such a way of looking at a binary data in two ways resembles that of an ambigram, which is a piece of calligraphy that can be read in two ways by rotating it or introducing other perspectives. The proposed ambigramic image file format is compared with the graph ics interchange format (GIF) experimentally, and the results show the better quality of the ambigramic images than that of GIF images. Keywords: ambigram, image file format, error diffusion, integral image-based signal-to-noise ratio (ISNR). GJCST-F Classification: I.3.3 AnAmbigramicImageFileFormat Strictly as per the compliance and regulations of: © 2021. Wenyi Cui, Kohei Inoue & Kenji Hara. This is a research/review paper, distributed under the terms of the Creative Commons Attribution-Noncommercial 3.0 Unported License http://creativecommons.org/licenses/by-nc/3.0/), permitting all non commercial use, distribution, and reproduction in any medium, provided the original work is properly cited. An Ambigramic Image File Format Wenyi Cui α, Kohei Inoue σ & Kenji Hara ρ Abstract- We propose an image file format that can be read in for evaluating the quality of halftone images including two ways, where two images are recorded in a single file as a palette-based images such as GIF images. bit sequence, and the forward reading the bit sequence makes The rest of this paper is organized as follows: one of the two images visible, or the backward reading makes Section 2 describes the proposed algorithm for another image visible. Such a way of looking at a binary data generating ambigramic bit sequences. Section 3 shows in two ways resembles that of an ambigram, which is a piece of calligraphy that can be read in two ways by rotating it or experimental results. Finally, Section 4 concludes this introducing other perspectives. The proposed ambigramic paper. 2021 image file format is compared with the graphics interchange format (GIF) experimentally, and the results show the better II. Proposed Ambigramic Image Data Year quality of the ambigramic images than that of GIF images. Structure 1 Keywords: ambigram, image file format, error diffusion, integral image-based signal-to-noise ratio (ISNR). In this section, we propose a method for formatting image data into an ambigramic data I. Introduction structure, which is recorded in a binary file. Assume that two images are given as an input data as A = [a ] and B mbigram is a typographical design that can be ij = [bij], where aij and bij denote color vectors at the pixel read in multiple orientations as shown in Fig. 1, position (i; j) in the images A and B, respectively, for i = A where a word ‘ambigram’ is written in a 1; 2; : : : ;m and j = 1; 2; : : : ; n, i.e., A and B are the rotationally symmetric manner. There are other types of same size. Then we attempt to store A and B in a ambigrams such as mirror, perceptual shift and 3D storage as a single file. Figure 2 illustrates the situation, ambigrams [1]. Langdon [2], [3] has made a lot of where A and B are represented by a bit sequence, and interesting ambigrams for a long time. Those stored in some place of a storage. If we read the bit ambigramic artworks give pleasure to the viewers, and sequence from left to right, then we see the image A. On provide great inspiration for artists and engineers. the other hand, if we read it from right to left, then we F () see the image B. The procedure for constructing such a bit sequence from A and B is described as follows. Figure 1: Example of ambigram Inspired by such successful ambigrams, in this paper we suggest an application of the idea of ambigram to an ambigramic interpretation of a bit sequence. In other words, we propose a method for Figure 2: Illustration of an ambigramic bit sequence describing two images with a bit sequence, which is a Let us consider a typical case that aij and bij are digital ambigram that can be seen as one of the two 24-bit RGB color vectors as aij = [ , , ] and bij images if the bit sequence is read forward direction, or =[ , , ], each element of which is represented by as another image if the bit sequence is read backward 8 bits. Here, we introduce a binary representation of direction. The proposed ambigramic images are as ( 1 2 3 4 | 5 6 7 8 )2, where the third compared with the graphics interchange format (GIF) Global Journal of Computer Science and Technology Volume XXI Issue I Version subscript in each element ranging from 1 to 8 indicates images [4], and the effectiveness of the proposed method is demonstrated in the experiments using the significance of each digit, i.e., 1 denotes the most natural images, where an image quality measure is used significant bit (MSB), and 8 denotes the least significant bit (LSB) in this binary representation. Other elements in aij and bij are also represented in binary in Author α σ ρ: Department of Communication Design Science, Kyushu the same manner as . Moreover, we abbreviate a University, 4-9-1, Shiobaru, Minami-ku, Fukuoka, 815-8540 Japan. e-mails: [email protected], series of four bits 1 2 3 4 to 1:4 for the sake of {k-inoue, hara}@design.kyushu-u.ac.jp simplicity. ©2021 Global Journals An Ambigramic Image File Format Our basic principle is to preserve more Where k and l denote relative indices to access the significant bits of the original image data in the resultant neighboring pixels, and wk,l denotes error diffusion ambigramic image file. Following this principle, we first coefficients or error filter [5]. On the other hand, for the extract four MSBs from both A and B as follows: last pixel in image B, the original color vector bm,n changes to rA ; gA ; bA ; rA ; gA ; bA ; ··· 1;1;1:4 1;1;1:4 1;1;1:4 1;2;1:4 1;2;1:4 1;2;1:4 A A A 2(rB jbA ) 3 ··· ; rm;n; 1:4; gm;n;1:4; bm;n;1:4 (1) m;n;1:4 1;1;4:1 2 ~ B A B B B B B B bm;n = 4(gm;n;1:4 jg1;1;4:1)25 : (8) r1;1;1:4; g1;1;1:4; b1;1;1:4; r1;2;1:4; g1;2;1:4; b1;2;1:4; ··· B A (bm;n;1:4jr1;1;4:1)2 B B B ··· ; rm;n; 1:4; gm;n;1:4; bm;n;1:4 (2) where the horizontally adjacent pixels are separated by Algorithm 1 Constructing ambigramic bit sequence semicolons. Next, we reverse the order of the bit 1: procedure AMBIGRAMIC(A; B) 2021 sequence in (2) as follows: 2: A~ ← zeros like(A) where A = [aij] Year 3: B~ zeros like(B) where B = [b ] B B B ← ij bm;n;4:1; gm;n;4:1; rm;n;4:1; ··· 4: m; n; ← A.shape B B B B B B 2 ··· ; b ; g ; r ; b ; g ; r (3) ← 1;2;4:1 1;2;4:1 1;2;4:1 1;1;4:1 1;1;4:1 1;1;4:1 5: for i 1 to m do 6: i m + 1 − i where note that the third subscripts (1:4) is also R ← 7: for j 1 to n do ← reversed as (4:1), e.g., 1,1,4:1 denotes 8: jR ← n + 1 − j . Then we combine (1) and (3) as 1,1,4 1,1,3 1,1,2 1,1,1 9: Round the elements of a and b to 8-bit ij iR;jR follows: integers 2 A B 3 A B A B A B (ri;j;1:4jbi ;j ;4:1)2 (r1;1;1:4jbm;n;4:1)2;(g1;1;1:4jgm;n; 4:1)2; (b1;1;1:4jrm;n;4:1)2; R R 10: ~ (gA jgB ) aij ← 4 i;j;1:4 iR;jR;4:1 25 ··· ; A B (b jr )2 i;j;1:4 iR;jR;4:1 A B A B A B B A (r jb )2;(g jg )2; (b jr )2 2(r jb ) 3 m;n;1:4 1;1;4:1 m;n;1:4 1;1;4:1 m;n;1:4 1;1;4:1 iR ;jR;1:4 i;j;4:1 2 (4) 11: b~ (gB jgA ) iR;jR ← 4 iR ;jR;1:4 i;j;4:1 25 B A (b jr )2 which can be viewed as an ambigramic bit sequence, iR ;jR;1:4 i;j;4:1 A 12: eij ← aij − a~ij F because if we read the bit sequence in (4) from left to () B ~ 13: e b − b right then the four MSBs in every pixel show the image iR;jR ← iR;jR iR;jR A, on the other hand, if we read it from right to left then 14: for (k; l) 2 KL ij do A the four LSBs in every pixel are inversely read to show 15: ai+k;j+l ← ai+k;j+l + wk;lei;j the image B.