You are on page 1of 4

Image Scrambling

Based on a New Linear Transform


Abhijeet A. Ravankar, Stanislav G. Sedukhin
Graduate Department of Computer Science,
The University of Aizu, Aizu-Wakamatsu, Fukushima, Japan 965-8580
Email: {m5132105, sedukhin}@u-aizu.ac.jp
AbstractA new linear transform for scrambling images is
proposed in this paper. The forward transform scrambles the
image and the inverse transform unscrambles the image. We
dene transformation matrices for both scalar and blocked
cases. Recursive and non-recursive algorithms based on the
new transform are also proposed. The degree of scrambling or
unscrambling can be determined by the user. The experimental
results show that the positions of the pixels are strongly irreg-
ularized using the proposed transform. Unscrambling using a
wrong key fails and results in an unintelligible image which
cannot be recognized. We also show that the new transform
provides a high level of image scrambling and is robust under
common attacks and noise. The proposed linear transform is very
simple and its implementation as triple-matrix multiplication is
straightforward.
I. INTRODUCTION
The security of multimedia digital image and video, for
example, condential transmission of images and video, video
conferencing, video surveillance, satellite data etc. has become
increasingly important [1]. Image encryption and watermark-
ing are often used for security of digital multimedia. This
paper focuses on encryption. Image scrambling is used for
image (and video frame) encryption and transforms a mean-
ingful image into an unintelligible image. The unintelligible
image can be decrypted back to meaningful image using a key
which is known only to sender and receiver.
Scrambling algorithms based on chaos theory are popular
and many scrambling approaches based on chaos theory have
been proposed [2], [3]. Others have suggested to scramble
MPEG video sequence in DCT domain [4]. We present a new
linear transform whose implementation for image scrambling
is very simple and straightforward. The coefcients of the
transformation matrix of the proposed linear transform are
composed of only 1 and 0. Based on the new linear transform,
we propose an algorithm which can recursively and/or non-
recursively scramble an image. The degree or amount of
scrambling can easily be controlled by the user. We show that
this new approach is very robust under common attacks.
The outline of the paper is as follows. The new linear
transform for scrambling images is proposed in Section II,
describing the forward and inverse transform. Transformation
matrix for blocked data is given in Section III. Section
IV proposes an algorithm for scrambling images using the
proposed transform. Section V discusses the experimental
result, including the robustness evaluation against noise, time
complexity etc. Finally, Section VI concludes this paper.
II. A NEW LINEAR TRANSFORM
Image information is generally represented in the form of
an array of pixels. Suppose an image consisting of N N
pixels has to be scrambled. First, we dene the transformation
matrix of the new linear transform used for scrambling as
given below.
Denition 1: A permutation of a nite set of N elements
{0, 1, ..., N 1}, is the rearrangement of its elements and
represented as : {0, 1, ..., N 1} {0, 1, ..., N 1}. It is
represented in two line form by
_
0 1 ... N 1
(0) (1) ... (N 1)
_
,
and, the corresponding NN permutation matrix P

is given
by
P

=
_
e
(0)
, e
(1)
, ..., e
(N1)

T
=
_
e
j0
, e
j1
, ..., e
j
N1

T
,
where, e
j
denotes a row vector of length N, with 1 in the j
th
position and 0 in every other position [5].
Denition 2: Kroneker-delta is a function of two variables,
usually integers, which is 1 if they are equal, and 0 otherwise,
and is given as [5]:
(i, j) =
_
1, i = j;
0, i = j.
(1)
Denition 3: Let N be a positive integer, the N N
linear transformation matrix C is created by rearranging the
rows and/or columns of NN identity matrix I, and is given
by C = (x, (x)), where, denotes Kroneker-delta function,
and, permutation is given by
_
0 1 ... x
(0) (1) ... (x)
_
, 0 x < N, where,
(x) =
_
x
2
, x is even;
N
x
2
1, x is odd.
(2)
For example, for N = 4, the appropriate permutation given
by eq.(2) is
=
_
0 1 2 3
0 3 1 2
_
,
and the linear transformation matrix
C =
_

_
e
(0)
e
(1)
e
(2)
e
(3)
_

_
=
_

_
e
j0
e
j3
e
j1
e
j2
_

_
=
_

_
1 0 0 0
0 0 0 1
0 1 0 0
0 0 1 0
_

_
.
3105
978-1-61284-774-0/11/$26.00 2011 IEEE
Now, we dene forward transform and inverse transform
used to perform image scrambling and unscrambling as given
below.
Forward Transform: If, D represents an N N pixel
matrix data (of an image or video frame), and C is linear
transformation matrix, then, the triple matrix product, S
C DC
T
, provides the required image scrambling, where
S is the nal scrambled N N pixel matrix. An example of
scrambling a 4 4 pixel-matrix is given below:
_

_
1 0 0 0
0 0 0 1
0 1 0 0
0 0 1 0
_

_
00 01 02 03
10 11 12 13
20 21 22 23
30 31 32 33
_

_
1 0 0 0
0 0 1 0
0 0 0 1
0 1 0 0
_

_
=
_

_
00 03 01 02
30 33 31 32
10 13 11 12
20 23 21 22
_

_
.
Inverse Transform: If, S represents an N N scrambled
pixel matrix data, and C is linear transformation matrix, then,
the triple matrix product, D C
T
S C, provides
the required image unscrambling, where D is the original
unscrambled NN pixel matrix. An example of unscrambling
a 4 4 pixel-matrix, scrambled using forward transform
described above, is given below:
_

_
1 0 0 0
0 0 1 0
0 0 0 1
0 1 0 0
_

_
00 03 01 02
30 33 31 32
10 13 11 12
20 23 21 22
_

_
1 0 0 0
0 0 0 1
0 1 0 0
0 0 1 0
_

_
=
_

_
00 01 02 03
10 11 12 13
20 21 22 23
30 31 32 33
_

_
.
Properties of the transformation matrix C are discussed.
Determinant |C| = 1. C is orthogonal matrix i.e. CC
T
=
I, where I is identitity matrix. C is invertible and C
1
=
C
T
. Notice that well-known 2D separable transforms like 2D-
DFT (Discrete Fourier Transform), 2D-DCT (Discrete Cosine
Transform) etc. are also similarly represented in the form of
triple matrix product.
III. TRANSFORMATION MATRIX FOR BLOCKED DATA
We can now consider the case when, instead of a single
pixel, pixels are initially blocked, and then these blocks of
pixels are scrambled. It is necessary to consider this from
practical point of view because, in case of images with high
resolution, the number of pixels may be extremely large and
blocking pixels will be a way to improve efciency. Let NN
image pixels be blocked into b b blocks, so that there are
a total of (N/b)
2
blocks of pixels. The transformation matrix
C which scrambles the image block-wise, can also be formed
from Denition 3. The process is to rst form an N/b N/b
transformation matrix C using Denition 3, and then form the
nal N N transformation matrix by replacing the element 1
of the transformation matrix C with an identity-matrix of size
b b, and 0 with a zero-matrix of size b b. For example, for
N = 8 and b = 2, rst form a 4 4 transformation matrix
as shown in the example of Denition 3. Then, the element
1 of the 4 4 transformation matrix is replaced with a 2 2
identity matrix, and 0 with 2 2 zero matrix, to give the nal
8 8 transformation matrix as,
_

_
1 0 0 0
0 0 0 1
0 1 0 0
0 0 1 0
_

_
_
_
_
_
_
_
_
_
_
_
_
1 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 1 0 0
_
_
_
_
_
_
_
_
_
_
_
_
.
The entire N N image is blocked into b b blocks and,
instead of carrying out scalar matrix multiplication, blocked
matrix multiplication S
B
C
B
D
B
C
T
B
is carried out to
scramble the image. The unscrambling operation can be done
in a similar way by performing D
B
C
T
B
S
B
C
B
.
IV. ALGORITHM FOR IMAGE
SCRAMBLING/UNSCRAMBLING
Using the linear transform described above, two simple and
straightforward approaches are presented here. The rst ap-
proach is the non-recursive approach in which an NN image
is fully scrambled K
N
times (1 K
N
< N), and K
N
is
the key for non-recursive scrambling. In a recursive approach,
an N N image is recursively scrambled progressively from
K
R
K
R
to N N, where K
R
is the key for recursive
scrambling (1 K
R
N). Thus, a user can control the
amount of scrambling by providing how much of scrambling
should be done, either recursively and/or non-recursively. A
mixed approach can also be used. An algorithm for scrambling
is given below.
The algorithm for unscrambling is straightforward and just
the reverse of the scrambling algorithm, with the only dif-
Algorithm 1 Scrambling
1: if NON RECURSIVE = TRUE then
2: assert(1 K
N
< N);
3: for count 1 to K
N
do
4: forward transform(N, N);
5: end for
6: end if
7: if RECURSIVE = TRUE then
8: assert(1 K
R
N);
9: for count K
R
to N do
10: forward transform(count, count);
11: count count + K
R
;
12: end for
13: if N%K
R
= 0 then
14: forward transform(N, N);
15: end if
16: end if
3106
Fig. 1. Original image Fig. 2. Non-recursively scrambled
K
N
= 1
Fig. 3. Non-recursively scrambled
K
N
= 27
Fig. 4. Unscrambling with wrong
K
N
= 25
Fig. 5. Recursively scrambled K
R
=
1
Fig. 6. Unscrambling with wrong
K
R
= 2
Fig. 7. Recursively scrambled K
R
=
25
Fig. 8. Unscrambling Fig.7 with
wrong key K
R
= 18
Fig. 9. Mixed scrambling K
N
= 27
and K
R
= 34
Fig. 10. Unscrambling with wrong
K
N
= 25 and correct K
R
= 34
Fig. 11. Unscrambling with correct
K
N
= 27 and wrong K
R
= 29
Fig. 12. Unscrambling with correct
K
N
= 27 and K
R
= 34
Fig. 13. Afte adding Salt-and-Pepper
Noise to fraction 2% of image
Fig. 14. Unscrambling after adding
Salt-and-Pepper Noise
Fig. 15. After adding Gaussian Noise
with = 0.03
Fig. 16. Unscrambled after adding
Gaussian Noise
ference that inverse transform is performed instead of forward
transform. If the keys K
N
and/or K
R
does not match, image is
not unscrambled properly (discussed in Section V). Notice that
the algorithm provided above is just one of the straightforward
ways to scramble an image, and other algorithms can be
developed. For example, entire image may be blocked into bb
blocks (b N/2) and b b scrambling may be carried out,
i.e. individual blocks themselves may be scrambled recursively
and/or non-recursively rst. Later, these b b blocks can be
scrambled amongst themselves using the blocked transforma-
tion matrix discussed in Section III. The inverse transform
always holds true and will unscramble the image. Blocking
the images and then scrambling the individual blocks also
have the advantage that it can be used to scramble images
of dimensions M N, where M = N, i.e. for non-square
images. Also notice that, although we used forward transform
to scramble, and inverse transform to unscramble the image,
the opposite is also true. It means that, inverse transform can
be used to scramble, and forward transform can be used to
unscramble the image.
3107
V. EXPERIMENTAL RESULTS
Scrambling of grayscale 128 128 Lena image (Fig.1) is
shown as an example. A onetime non-recursive scrambling
(i.e. K
N
= 1) is shown in Fig.2. Even scrambling once makes
the image unintelligible. Fig.3 shows non-recursive scrambling
with K
N
= 27, which is clearly strongly scrambled. Fig.4
shows the result of unscrambling the image with a wrong key
K
N
= 25 (correct key is K
N
= 27). Clearly, the image is not
unscrambled with a wrong key and the result image is in no
way meaningful.
Fig.5 shows the result of recursive scrambling with K
R
= 1,
which results in full-scale scrambling of image from 1 1
to N N (here, N = 128). It is clear that the position of
pixels are strongly irregularized compared to non-recursive
scrambling. Fig.6 shows the result of descrambling Fig.5 with
a slightly different key (K
R
= 2). Similarly, Fig.7 shows
recursive scrambling with K
R
= 25 and Fig.8 shows unscram-
bling it with a wrong key K
R
= 18. Clearly, unscrambling
fails with a wrong key in both the cases, and the resultant
image is still highly unintelligible.
Fig.9 shows both recursive and non-recursive scrambling
done with K
N
= 27 and K
R
= 34. Fig.10 shows the result
of unscrambling it with a wrong K
N
= 25 but correct K
R
=
34. Similarly, Fig.11 shows the result of unscrambling Fig.9
with a correct K
N
= 27 but wrong K
R
= 29. Fig.12 shows
unscrambling with both correct keys. Clearly, unscrambling
fails when even one of the keys is wrong and the resultant
pixel information cannot be recognized.
We evaluated the scrambled images for robustness as they
are always prone to common attacks. We used the scrambled
image shown in Fig.5 which is the result of scrambling with
K
N
= 27 and K
R
= 34. We added two kinds of noise to
this scrambled image. One is the salt and pepper noise [6]
and the other is Gaussian noise [7]. Salt and pepper noise
was added to fraction 2% of scrambled image and is shown
in Fig.13. Fig.14 shows the unscrambled image. Notice that
although the Salt and Pepper noise is visible, the unscrambled
image is still meaningful. Similarly, zero-mean Gaussian noise
added to Fig.5 with a standard deviation = 0.02 is shown in
Fig.15. Fig.16 shows the corresponding unscrambled image.
Notice that in both the cases, the unscrambled image is still
meaningful and properly represent the information in the
original image.
The worst case time complexity of the algorithm (when
K
N
= N 1 and K
R
= 1) can be estimated as
N
3
(N 1) +
(N
2
)(N+1)
2
4
1 O(N
4
),
where N is the dimension of the image to be scrambled.
The transformation is represented in the form of triple matrix
product whose complexity is O(N
3
). Faster algorithms can
easily be developed to reduce the complexity to O(N
2
) as
the transform involves multiplication with 0-1 permutation
matrices. The total time for scrambling and unscrambling of
128 128 Lena image using various keys described in this
paper, including the generation of permutation matrix and
calculating its transpose on the y, was achieved in less than
2 seconds (on Intel Core2 Duo CPU, 2.93 GHz), using serial
algorithm, which is acceptable for security. For highly parallel
computations, triple-matrix product can be computed in 2N
steps on an array of N N processors [8], so that, the worst
case time-complexity of the algorithm is reduced from O(N
4
)
to O(N
2
). Moreover, highly optimized kernels exits for matrix
multiplication on various advance multicore processors like
Cell/B.E [9], GPU, and specialized scalable hardware for
efcient matrix multiplication has also been proposed [10].
VI. CONCLUSION
In this paper, we proposed a new linear transform for
scrambling images. The coefcients of the transformation
matrix are composed of only 0 and 1. The forward transform
scrambles the image and the inverse transform unscrambles
it. We dened transformation matrices for both scalar and
blocked cases. We presented an algorithm which can re-
cursively and/or non-recursively scramble an image. Image
scrambling using the proposed transform strongly irregularizes
the pixels of the image. We showed that unscrambling fails
when a wrong key is used and the resultant image is still
not recognizable. Scrambled images are common to attacks
and noise. The proposed transform is robust against common
attacks. We added noise to the scrambled images and the
recovered images could easily be recognized. The newly
proposed transform is very simple and its implementation as
triple-matrix multiplication is straightforward.
REFERENCES
[1] D. Van De Ville, W. Philips, R. Van de Walle, and I. Lemahieu, Image
scrambling without bandwidth expansion, Circuits and Systems for
Video Technology, IEEE Transactions on, vol. 14, no. 6, pp. 892 897,
2004.
[2] R. Matthews, On the derivation of a chaotic encryption algorithm,
Cryptologia, vol. 8, pp. 2941, January 1984. [Online]. Available:
http://portal.acm.org/citation.cfm?id=67071.67073
[3] J. Scharinger, Fast encryption of image data using chaotic kolmogorov
ows. in Storage and Retrieval for Image and Video Databases
(SPIE)97, 1997, pp. 278289.
[4] W. Zeng and S. Lei, Efcient frequency domain selective scrambling of
digital video, IEEE Transactions on Multimedia, vol. 5, pp. 118129,
2002.
[5] W.-H. Steeb, Matrix Calculus and Kronecker Product with Applications
and C++ Programs. World Scientic, 1999.
[6] L. Bar, N. Sochen, and N. Kiryati, Image deblurring in the presence of
salt-and-pepper noise, in Lecture Notes in Computer Science. Springer,
2005, pp. 107118.
[7] D. u Lee, J. D. Villasenor, S. Member, W. Luk, P. H. W. Leong, and
S. Member, A hardware gaussian noise generator using the box-muller
method and its error analysis, IEEE Trans. Computers, vol. 55, pp.
659671, 2006.
[8] S. Sedukhin, A. Zekri, and T. Myiazaki, Orbital algorithms and unied
array processor for computing 2D separable transforms, in (2010) 39th
International Conference on Parallel Processing Workshops (ICPPW),
2010, pp. 127 134.
[9] J. Kurzak, W. Alvaro, and J. Dongarra, Optimizing matrix
multiplication for a short-vector simd architecture - cell processor,
Parallel Comput., vol. 35, pp. 138150, March 2009. [Online].
Available: http://portal.acm.org/citation.cfm?id=1513001.1513316
[10] A. A. Ravankar and S. G. Sedukhin, Mesh-of-tori: A novel interconnec-
tion network for frontal plane cellular processors, ICNC, International
Conference on Networking and Computing, pp. 281284, 2010.
3108

You might also like