1. Introduction
With the rapid development of the Internet, image editing softwares, such as Photoshop, Snapseed and Mix, have been rapidly developed. These software programs allow people to edit images easily, which means that digital images are vulnerable to be tampered during transmission. Under this trend of Internet development, authenticating the integrity of digital images is gradually becoming an important issue. Fragile watermarking method is a commonly used authentication technique by embedding the authentication code into the image in order to provide protection [
1,
2,
3,
4]. If the image is tampered during transmission, then the authentication code embedded in the image will also be changed. Therefore, it is possible to know whether an image has been tampered with by determining whether the embedded authentication code has been changed.
Depending on the domain in which the authentication code is embedded, fragile watermarking can be divided into two types, spatial domain and compressed domain. The methods of spatial domain [
5,
6,
7,
8] embed the authentication code directly into pixels of the image, this type of technique allows to obtain a high image quality and a large space for carrying information. The image authentication methods of the compressed domain [
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22], on the other hand, embed the authentication code into the compressed code. Compressed images are preferred for transmission over the network because smaller files facilitate network transmission. Currently, the joint photographic experts group (JPEG) [
9,
10], vector quantization (VQ) [
11,
12], absolute moment block truncation coding (AMBTC) [
13,
14,
15,
16,
17,
18,
19,
20,
21,
22] and so on are commonly used compression techniques. Among these techniques, AMBTC requires less computation and has a satisfactory compression rate, which has attracted some research in this area in recent years [
13,
14,
15,
16,
17,
18,
19,
20,
21,
22].
AMBTC [
23], proposed by Lema and Mitchell in 1984, is an improved version of block truncation coding (BTC) [
24]. It compresses the image blocks into trios, each trio consisting of two quantization values and a bitmap. The existing AMBTC authentication methods typically embed the authentication codes into the quantized values or bitmaps. Based on the AMBTC compression method, [
15] uses a pseudo random number generator (PRNG) to generate the authentication codes and embeds them into the quantized values. Their method is effective in protecting the image to some extent, but the authentication codes can only in base 7. Ref. [
16] also proposes a method for AMBTC image authentication based on a special designed reference table, and this method outperforms previous works in terms of marked image quality. However, their approach does not utilize bitmaps to generate authentication codes, resulting in the inability to detect bitmap tampering. Ref. [
17] proposes an authentication method with higher security based on the weaknesses of [
16]. Ref. [
17] generates the authentication code by performing exclusive-or operation of the bitmap with random numbers, which not only maintains the same image quality as in [
16], but also detects tampering of the bitmap. To obtain a better authentication effect and marked image quality, [
18] uses quantized values of most significant bites (MSB) and bitmaps to generate authentication codes and embeds them into quantized values of least significant bits (LSB). Their method also perturbs the MSB of the quantized values to reduce the error of embedding. Thus, [
18] not only preserves the image effectively, but the image quality is also comparable to the method of [
17]. To detect the splice tampering, [
20] utilizes the block location information in addition to the bitmap to generate the authentication code. They generate different authentication codes by toggling the bitmap and select the authentication code that causes the least error to embed into the quantized values. However, their method does not considered the flipped bitmap may result in a better embedding performance, thus limiting the image quality improvement.
Ref. [
19] combines the bitmap with a pseudo-random sequence to generate a 3-bit authentication code, which is embedded into the quantized values by surveying the reference table. Also, this method uses an iterative embedding mechanism to solve the problem that the high quantized values might be smaller than the low ones after embedding. Due to the relatively compact arrangement of the numbers inside reference table, their method achieves a better marked image quality. However, based on the limitations of the searching method, this method can only embed an octal (3 bits) authentication code for each pixel pair. In addition, their searching approach may not find the best marked quantized values to reduce the embedding error. Finally, the authentication code of this method is generated independently of the location information, which makes the swapping of image blocks undetectable.
The existing methods [
15,
16,
17,
18,
19,
20] can achieve most of the tampering detection and a good image quality. However, due to the design of the embedding technique, the authentication code in [
15] can only be digits of base 7, [
16,
17] can only be digits of bases 2, 4, 8 and 16, while [
19] can only be digit of base 8. Furthermore, the authentication code generation of [
15,
16], [
18,
19] is independent of the bitmaps or block location information, causing these methods unable to detect some specific malicious tampering. Compared to [
15,
16,
17,
18], the image quality obtained by [
19] is the highest, but the searching approach of this method limits the enhancement of image quality. In contrast to [
19], the method of [
20] uses a filtering mechanism to reduce the error and obtains a better marked image quality. Nevertheless, the filtering mechanism in [
20] does not take into account some characteristics of AMBTC codes, which means that the image quality can be further improved.
For an AMBTC code, if the quantized values are swapped and the bitmap is flipped, the decompressed block will be exactly the same as the one decompressed from the original code [
25]. Based on this attractive property, the proposed method toggles one bit of the original and flipped bitmaps in sequence to generate a set of authentication codes. By surveying the reference table, the authentication code that causes the least error is embedded in quantized values using the PPM technique. Experimental results show that our method not only embeds authentication codes of arbitrary length and obtains the highest image quality, but also achieves a satisfactory detection results compared with the aforementioned methods.
The rest of the paper is structured as follows.
Section 2 will introduce the AMBTC compression and the reference table based (RT-based) technique.
Section 3 will introduce the proposed method, and experimental results and conclusions will be given in
Section 4 and
Section 5, respectively.
2. Related Works
This section will briefly introduce the basic concepts of AMBTC and the RT-based embedding techniques required by [
19] and the proposed method. The details will be presented in the following two subsections.
2.1. AMBTC Compression Method
To encode the image
using the AMBTC compression method, firstly we divide
into
non-overlapping blocks
of size
, and calculate the average value
of block
:
where
represents the
j-th pixel of
i-th block. Next, the value of the
j-th bit
in the bitmap
is obtained by comparing all the pixels of
with
:
Based on
, the low quantized value
and the high quantized value
can be calculated by:
where
and
are the number of ‘0’ and ‘1’ in
, respectively. All blocks are processed in the same procedures, and the compression codes
of the image
is obtained. The decompressed block
can be obtained by decoding
using the equation
where
is the
j-th pixel of
. All codes
are decompressed in the same manner, and we eventually obtain the decompressed image
.
Here we briefly introduce the encoding and decoding procedures of AMBTC using a block. Assume a block of size is [66, 85, 87, 62; 91, 79, 86, 97; 85, 57, 56, 69; 52, 72, 97, 43]. The mean of is calculated firstly. Next, According to Equations (2)–(4), we obtain [0, 1, 1, 0; 1, 1, 1, 1; 1, 0, 0, 0; 0, 0, 1, 0], , and . We can use Equation (5) to decode , and the decompressed block [60, 88, 88, 60; 88, 88, 88, 88; 88, 60, 60, 60; 60, 60, 88, 60] can be calculated.
2.2. The Embedding Techniques Based on Reference Table
The RT-based embedding techniques embed a digit of base
into each pixel pair by surveying a reference table. The reference table is a matrix of size
with numbers in the range from 0 to
. The RT-based techniques to be introduced in this section are the turtle shell embedding (TSE) [
26] and the pixel pair matching (PPM) techniques [
27].
Figure 1a,b show partial reference tables for TSE and PPM, both of which can be used to embed digits of base
.
The TSE embedding method embeds a digit ranging from 0 to
into a pixel pair
by surveying a 3-bit reference table
. The value located in
in the
can be generated by the following equation [
28].
where
and
are ranging from 0 to 255. After the reference table
is generated, the digits in
can be grouped into three categories according to their positions. Different categories use different search methods to embed the authentication codes. In the first case, if
is not in the bounds of a complete hexagon (e.g.,
in
Figure 1a), then we find a location
that is the closest to
while satisfying
. In the second case,
is located in the edge of at least one hexagon, (e.g.,
or
in
Figure 1a), then we find a location
from all touched hexagons that is the closest to
while satisfying
. In the third case, if
is within a hexagon (e.g.,
in
Figure 1a), then we find a location
from the hexagon that satisfies
. Once the location
is found,
can be embedded by replacing pixel pair
with
.
However, the searching method provided by the TSE might not always gives the best solution. For example, suppose is to be embedded into , which is fitted in the second case. Since , and is closer to , we obtain the embedded pixel pair . Obviously, is a better solution for this problem because it is closer to than and also satisfies . A similar problem also might happen in the third case.
In contrast to the TSE technique, the PPM embedding method also adopts a reference table
to embed a digit of base
into each pixel pair, and the base of digit is not limited to 8. The reference table
can be generated by using the formula
where
is a constant. Some commonly used constants are
,
,
and
. See [
27] for a complete list of
. To embed
into a pixel pair
, the PPM method searches in the vicinity of
and finds a location
that is closest to
while satisfying
. During the extraction, reference table
and
are known, and the embedded authentication code can be extracted by
. Since the PPM method is more flexible and provides a satisfactory embedding performance, the PPM will be used as the embedding technique in our method.
Here is a simple example to illustrate the PPM. Let
be a reference table for embedding digits of base
. Suppose
and
. Since
and
is the closest to
(see
Figure 1b), the marked pixel pair
is obtained. The embedded authentication code
can be extracted by
.
3. The Proposed Method
The authentication codes generated by [
15,
16,
18] are independent of bitmaps or location information; therefore, these methods cannot detect tampering of bitmaps or swapping of image blocks. Ref. [
17] can detect some tampering missed by the above methods, but based on the design of the embedding method, the length of the authentication code and the quality of the marked image are limited. Among these methods, only [
18] can embed authentication code of arbitrary length. Moreover, the methods of [
15,
16,
17] are not designed with a selection mechanism to reduce the embedding error. In [
18], although the embedding error is reduced by perturbing the MSB of the quantized values, this method uses the LSB replacement which creates a large error, and therefore also limits the quality improvement. To enhance the image quality, [
19] employs the TSE to embed the authentication codes. The quality of marked images obtained by [
19] is higher than that of [
15,
16,
17,
18], due to the compact arrangement of digits in the reference table used by TSE. However, according to the analysis in
Section 2.2, it can be known that the best marked quantized values may not be found by using the search method of TSE. Moreover, due to the search method, TSE can only work with a 3-bit reference table to embed an authentication code of base 8. As in [
18], the generation of authentication codes in [
19] is independent of the location information, so the swapping of blocks cannot be detected.
In this paper, we use different approaches to embed authentication codes into smooth and complex blocks. Given a trio
of a block
, the smoothness of
is determined by
. If
, where
is a pre-defined threshold, the block is classified as a smooth one; otherwise, it is a complex one. It is known that if the quantized values are swapped and the bitmap is flipped, the decompressed block will be exactly the same as the one decompressed from the original trio [
25]. Based on this property, the proposed method toggles a bit in the original and flipped bitmaps of a smooth block to generate a set of authentication codes. These codes are embedded into the quantized values using the PPM, and the trio of the least distorted block after embedding the authentication code is selected as the marked trio. For a complex block, instead of using the toggling technique, only the original and flipped bitmaps are used to generate two authentication codes to reduce the computation cost.
3.1. Embedment of Smooth Blocks
Let
be the trio of a smooth block to be embedded with authentication codes, and
be the image block decoded from
. According to the precious property of the AMBTC method,
can also be obtained by decoding
, where
is
with all bits flipped. Let
,
,
,
,
, and
, then
and
can be expressed as
, where
. Let
be the bitmap of
with
bit toggled. Using MD5 [
29] to hash
and position information
, and folding each result into
bits, we obtain
candidates of authentication codes
. The PPM method described in
Section 2.2 is then applied to embed these authentication codes into pixel pairs
and we obtain
.
together with
can be decoded to obtain image blocks
. The Euclidian distances between
and
are calculated, and the one that has the shortest distance is found and is denoted by
. The trio of
, denoted by
, is the marked trio of our method. The procedures of finding the marked trio can be formulated as an optimization problem described below:
where de() is the decode function of AMBTC, and
is the function to acquire
authentication code.
Here is an example to illustrate the process of generating authentication codes using MD5. Let , , and the bitmap of the eighth block is [1, 1, 0, 0]. We use the position of the image block and the bitmap to perform the MD5 operation and obtain 128 bits hash code. Suppose the hex-decimal value of the 128 bits is ‘36b4c42c4c30d841672290f28e66186a’. Then, we fold the 128 bits in half. The first 64 bits are xor-ed with the remaining 64 bits, and we obtain the 64-bit xor-ed result (the hex-decimal value is ‘519654dec256c02b’). Repeat this procedure and finally we can obtain a 4-bit authentication code ‘0001’. In case it is not possible to obtain exactly 4 bits, the extra bits can be discarded. Note that the function used in this paper already contains the folding operation, which can output -bit authentication code directly.
Next, we use an example to illustrate the embedding procedures of a smooth block
. Assume
,
,
and
. Since
, and we have
,
{0001, 1101, 1011, 1000, 1001},
and
{1110, 0010, 0100, 0111, 0110}. Suppose the authentication codes generated from
, and
are
{2, 1, 10, 14, 3} and
{9, 10, 11, 8, 2}. The codes
and
are then embedded into (74, 76) and (76, 74) using the PPM. According to the reference table
shown in
Figure 2, we obtain
{(73, 76), (73, 75), (74, 78), (75, 76), (73, 77)} and
{(77, 75), (77, 76), (75, 73), (77, 74), (76, 74)}. The trios
are then decoded and we obtain
. The squared distance between
and
is 11, 4, 24, 3, 4, 4, 15, 4, 5 and 0. Since
has the shortest distance to
(distance is 0), and the final marked trio
can be obtained.
3.2. Embedment of Complex Blocks
It is noted that toggling bits in the bitmaps often causes large errors when the difference between high and low quantized values is large. Thus, for complex blocks, most of the bitmaps of the solutions to Equations (8)–(12) are
and
, i.e., either original bitmap
or the flipped bitmap
is found in the marked trio. Based on the consideration of computational cost, the toggling technique will not be used in generating authentication codes for complex blocks. Given a trio
of a complex block, the location information
and bitmaps
are used to generate two authentication codes
with
bits using Equation (9). Next, the codes
are embedded into
using the PPM and we obtain the marked trios
. Then, decompress
to obtain blocks
and find the block
that has the shorter distance with
. The trio of
, denoted by
, is selected as the final marked trio. The embedding procedures of the proposed method can be seen in
Figure 3.
A simple example is presented to show the embedding procedures of a complex block
. Let
,
,
and
. Since
, we have
and
. Suppose the authentication codes generated from
and
are 8 and 12, and embed them into (71, 79) and (79, 71), respectively, using the PPM. According to the reference table
shown in
Figure 2, we know
and
. Therefore,
and
can be obtained. The trios
and
are decoded to obtain block
and
. Next, the squared distance between
and
is 2, while the squared distance between
and
is 4. Since
has the shorter distance to
, and we obtain the final marked trio
.
3.3. The Authentication Procedures
This sub-section describes the authentication procedures of the proposed method. Assume that the to-be-authenticated trios are
. For each trio
, use the function
to generate an
authentication code
. Then, by surveying the reference table
, the authentication code
embedded in
is extracted, and determine whether
and
are equal. If
, then this block has not been tampered with; otherwise, it has been tampered with. The detailed procedures can be found in
Figure 4.
The above authentication procedures are called the first stage authentication. To refine the detection result, the second stage authentication is adopted in the proposed method. Since collisions may occur during authentication, the smaller the length of the embedded authentication code, the higher the probability of collision. It means that more blocks are tampered with but not detected in the first stage authentication. We know that most of the tampering is clustered in a certain area. Thus, if an untampered block surrounded by blocks that have been tampered with, then the block may has been tampered with as well. Therefore, in the second stage authentication, if a block is detected as untampered in the first stage, but the blocks above and below or left and right of this block have been judged as tampered, the detection result of this block will be modified to be tampered. All blocks are processed using the procedures described above, and the final detection results are obtained.