You are on page 1of 32

Chapter 5

System Design

5.1 Chapter Introduction


In this chapter, the design of all the three proposed techniques and an authentication system
is described in detail. After studying the present literature about VC, the problem definition
and objectives of this research are framed. Each objective is achieved using a unique tech­
nique. The first objective is to increase the efficiency of the technique by sharing multiple
secrets. To achieve this objective a (2, 2) VC technique is developed which uses only two
shares to share two secrets. Most of the VC techniques do not have capability of sharing
multiple secrets. The VC techniques which can share multiple secrets, use round or circu­
lar or cylindrical shares. These are difficult to handle while recovering the secret image.
In the proposed (2, 2) VC technique, two rectangular shares are used and instead of ro­
tating the shares, flipping process is used. Other existing techniques for sharing multiple
secrets require secret images of same dimensions, but for the proposed technique there is
no such condition. The proposed technique increases the efficiency of the system in terms
of the number of secrets encrypted, the amount of storage space required for the shares and
amount of data required for transmission of the shares as compared with the other similar
techniques for sharing multiple secrets. In the proposed (2, 2) VC technique, two shares
are used for encrypting two secret images. First secret image is revealed by superimposing
both the shares while the second secret image is revealed by flipping the second share and
then superimposing on the first share.

39
5.1 Chapter Introduction

Most of the VC techniques suffer loss in contrast of recovered secret image. The reason
for this loss in contrast is failure to perfectly recover the white secret pixel. The techniques
that can perfectly recover the original secret image, use XOR­based VC which requires
small amount of computation. The proposed (2, 2) VC technique improves the contrast of
the recovered secret image. The contrast improvement is done by increasing the number of
basis matrices used for encrypting the white and black secret pixels. For individual black
and white recovered secret pixels the contrast values can be 0%, 25%, 50% or 75%. A white
pixel may have 0% contrast, it means the white pixel is recovered as black. Similarly the
black pixel can be recovered with 75% contrast, it means that black pixel is not perfectly
reconstructed. Even with this uncertainty of contrast of recovered secret pixel, the contrast
of the entire image increases. This happens because the human visual system has a tendency
to average out the contrast of the entire image. Hence, as compared with the traditional (2,
2) VC in which the recovered secret pixel has a maximum contrast of 50%, the proposed
(2, 2) VC technique has maximum contrast of 75%.
Another major problem in VC is of pixel expansion. Due to pixel expansion the recov­
ered secret image has larger dimensions as compared to the original secret image. The pixel
expansion may change the aspect ratio of the secret image. The large size of shares makes
them difficult to handle. More space is required to store the shares and also the amount
of data required for transmission of shares is more. The proposed technique uses bicubic
algorithm for reducing the dimensions of shares. The bicubic algorithm is slow, but it gen­
erates a smoother image and the image is free of any artifacts. The bicubic algorithm uses
16 nearby pixels for interpolation. The proposed (2, 2) VC for improving the contrast can
be combined with bicubic algorithm to get size­invariant and improved contrast recovered
secret image. The bicubic algorithm can be applied on the shares generated by most of the
techniques.
The final objective of the research is to develop an authentication system to share two
passwords. Such kind of system can be used to secure the secret information with the
help of passwords. The secret information can be revealed when both the desired persons
are present with their shares. This authentication system uses the proposed (2, 2) VC for
sharing two secrets and a simple GUI is used to extract the passwords from the shares.

RIRD, Satara, Shivaji University, Kolhapur 40


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

Once the passwords are extracted, the secret information can be revealed in presence of
both the persons. The detailed design of all the proposed techniques and the authentication
system is given in the subsequent sections.
Different type of objective and subjective parameters are used to analyse the quality of
recovered secret images. The objective metrics like MSE, PSNR, NCC and NAE may not
always give correct results. In some cases, even if the recovered secret image is of good
quality, the values of these parameters may not indicate that the quality is poor. Hence,
some of the subjective parameters are used for evaluating the quality of recovered secret
image. The subjective parameters are designed in such a way that they closely resemble
the perception to Human Visual System (HVS). The parameters that are used to analyse
the quality of recovered secret images are described in detail along with their significance
in the section 5.6.

5.2 Design of (2, 2) Visual Cryptography Technique to Share


Two Secrets
The traditional VC is used to share a single secret. The schemes can be (k, n) or (n, n), here
‘n’ shares will be used for encrypting a single secret image. For a (k, n) scheme, minimum
‘k’ shares are required to reveal a secret image and for (n, n) scheme, all the shares are
required to reveal the secret image. This proves that the efficiency of encryption is very low.
The focus of our technique is to increase the number of secrets that can be encrypted using
less number of shares. We have developed a (2, 2) VC technique for sharing two secret
images. Many people have worked in the area of multiple secret sharing. Some techniques
use circular, ring or cylindrical shares for encrypting multiple secrets. These techniques
can encrypt multiple secrets theoretically very easily, but the process for recovering the
secrets is very tedious. Firstly, it is difficult to maintain cylindrical or ring shaped shares.
Secondly, it is difficult to measure the angle of rotation by which the share is rotated. To
overcome these problems, we have developed a (2, 2) VC technique in which two secrets
can be shared using only two shares. The other advantage of this technique is that we can
share the secret images of different dimensions.

RIRD, Satara, Shivaji University, Kolhapur 41


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

Assume two secret images as shown in figure 5.1. In first secret image, there is a black
pixel and a white pixel at top left and top right corners respectively. For second secret
image, there are white pixels at top left and top right corners. In order to encrypt these
images, we have to apply a traditional (2, 2) VC on one of the images. Applying a (2, 2)
VC technique, generates two shares. When these shares are overlapped, the secret image
is revealed. Then one of the shares is modified according to our proposed technique. This
modified share is flipped horizontally and then overlapped on first share, to reveal the
second secret image.

Figure 5.1: Secret image A and Secret image B

The entire process is explained with the help of an example. The secret image A is
first encrypted using (2, 2) VC technique. For this two basis matrices are used as shown in
equation 5.1. The matrix B is used for sharing a black pixel of secret image and matrix W
is used for sharing a white pixel of secret image. The first row of both the matrices is used
for sharing a subpixel to share 1 and second row is used for sharing a subpixel to share 2.
   
1 1 0 0 0 0 1 1
W =  B=  (5.1)
1 1 0 0 1 1 0 0
In VC, 1 denotes black pixel whereas 0 denotes white pixel. If a black secret pixel
is to be shared, then the
 columns of
 matrix B are permuted randomly. Let matrix B after
1 0 0 1
permutation be B =  . The subpixel pattern for share 1 is taken from row
0 1 1 0

1 of matrix B as . A black pixel from secret image is represented using four


subpixels. If these subpixels are arranged horizontally, then the aspect ratio of the recovered
secret image will change. Hence, instead of arranging all four subpixels in a single row, two

subpixels are placed in first row and two subpixels are placed in second row as . This

RIRD, Satara, Shivaji University, Kolhapur 42


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

maintains the aspect ratio of the recovered secret image. This subpixel pattern is placed

at corresponding location in share 1. The second row of B matrix generates subpixel


pattern, this pattern is placed at corresponding location in share 2. So when these two shares
overlap, a perfectly black subpixel is recovered. Now, the top right pixel in secret image A
is white. To share a white pixel the columns
 of Wmatrix are randomly permuted. Let the
1 0 1 0
W matrix after permuting be W =  . This generates subpixel pattern
1 0 1 0

for share 1 and subpixel pattern for share 2. When these shares overlap, the recovered

subpixel will look like . So the white secret pixel is recovered with 50% contrast.
This process is repeated for the entire secret image A and two shares are generated. Out
of these two shares, one share is kept as it is while the second share is modified according
to the secret image B. For this, the second share is flipped horizontally and then modified
as per our proposed algorithm. Similar kind of process of flipping the shares for sharing
two secrets was used in [49]. The second secret image is having white pixel at top left
corner. To encrypt this white pixel, we have to use the proposed algorithm. According to
the proposed algorithm, we have to select only three subpixel patterns out of the six patterns
shown in figure 5.2.

Figure 5.2: Subpixel patterns for proposed algorithm

After selecting the subpixel patterns, we can start encrypting the secret image B. Here,
the pixel to be encrypted is white. Check the subpixel pattern at corresponding location
in share 1. If the subpixel pattern in share 1 is not present in the three selected subpixel
patterns, then the share 2 is not modified. But if the subpixel pattern in share 1 is present in
the three selected subpixel patterns, then share 2 is modified. If the secret pixel to be shared
is white, then the subpixel pattern present in share 1 is copied and placed at corresponding
location in share 2. If the secret pixel to be encrypted is black, then the subpixel pattern
opposite to the pattern present in share 1 is copied at corresponding location in share 2.

RIRD, Satara, Shivaji University, Kolhapur 43


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

This process is repeated for all the pixels in secret image B.


Coming back to our example, the secret pixel at the top left corner of secret image B
which is to be encrypted is white. Firstly, we have to select any three subpixel patterns out
of the six subpixel patterns shown in figure 5.2. Let the three selected subpixel patterns

be like this . Now we have to check the subpixel pattern in share 1 at

corresponding location. The subpixel pattern in share 1 at top left corner is . This
subpixel pattern is present in the three selected subpixel patterns, so the subpixel pattern at
corresponding location in share 2 can be modified. Since the secret pixel to be encrypted
is white, the same subpixel pattern that is present in share 1 is copied to the share 2 at
corresponding location.
Now, consider the pixel at top right corner of secret image B. While encrypting this
pixel, we have to check the subpixel patterns at corresponding location in share 1. The

subpixel pattern in share 1 at top right corner is . Now this pattern is not present in
the three selected subpixel patterns. So, the subpixel pattern in share 2 at corresponding
location is not modified. the entire share generation process is shown in diagramatic form
in figure 5.3. To reveal the secret image A, the share 1 and without flipped version of
modified share 2 must be overlapped. After overlapping these two shares, the top left pixel
of secret image A is correctly recovered as black and the right pixel in secret image A is
partially recovered as white. The contrast of the recovered secret pixel is 25% as there are
3 black and 1 white pixel. Similarly, when the share 1 and the modified flipped version
of share 2 are overlapped as shown in figure 5.4, the top left pixel in secret image B is
partially recovered as white with 50% contrast. The top right pixel in secret image B is
partially recovered as black with 25% contrast.
In this technique, the recovered secret pixels can have contrast values as 0%, 25%, 50%
and 75%. This means that a black pixel can be perfectly recovered and a white pixel can
have a maximum contrast of 75%. While encrypting the pixels of second secret image,
three subpixel patterns are selected out of 6, this ensures that approximately 50% pixels
from share 2 are modified. If more or less than 3 pixel patterns are selected then there is
a chance that only one secret image out of two will be properly recovered. The results of

RIRD, Satara, Shivaji University, Kolhapur 44


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

Figure 5.3: Shares generation process for the proposed technique

Figure 5.4: Process to reveal the two secret images

this technique are discussed in chapter 6.


The table 5.1 shows different possibilities for white pixel of secret image B and a spe­
cific case of three selected subpixels. If the subpixel pattern of share 1 from 3rd column

RIRD, Satara, Shivaji University, Kolhapur 45


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

from table 5.1 is present in the three selected subpixel patterns from 2nd column 5.1 only
then the subpixel pattern in share 2 at corresponding location is modified. For example, the

first subpixel pattern in share 1 is present in the three selected subpixel patterns, hence

Table 5.1: Possibilities of subpixel patterns for white pixel in secret image B
Recovered
The corre­
Secret Modified Subpixel by
The corre­ sponding
Pixel Three Selected Patterns in Overlapping
sponding Patterns in Contrast
in Subpixel Patterns Flipped Share 1 and
Patterns in Flipped (7)
Image (2) Share 2 Modified
Share 1(3) Share 2
B (1) (5) Flipped
(4)
Share 2 (6)

50%

25%

50%

25%

50%

0%

RIRD, Satara, Shivaji University, Kolhapur 46


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

the subpixel in flipped share 2 will be modified. The subpixel pattern at corresponding lo­

cation in flipped share 2 is assumed as . Since the secret pixel to be encrypted is white,
the subpixel pattern present in share 1 is copied at corresponding location in flipped share
2. When the share 1 and the modified flipped share 2 are overlapped, the subpixel pattern

at corresponding location in the recovered secret image will be . Hence, the contrast
of the recovered secret pixel is 50%. In the second case the subpixel pattern in share 1
is not present in the three selected subpixel patterns, hence the corresponding subpixel in

flipped share 2 is not modified. The subpixel pattern in flipped share 2 is and it will

be overlapped with the subpixel pattern from share 1 . After overlapping of the shares

the recovered subpixel will be and the contrast of the recovered subpixel will be 25%.
The probability that the white secret pixel will be recovered as black is 1/6. The probability
that the white pixel is recovered with 25% and 50% contrast is 1/3 and 1/2 respectively.
The table 5.2 shows the possibilities of subpixel patterns for black pixel in secret image
B for a specific case of the three selected subpixel patterns. Here, the black secret pixel is
completely recovered as black (0% contrast) and with 25% contrast with a probability 2/3
and 1/3 respectively.

RIRD, Satara, Shivaji University, Kolhapur 47


5.2 Design of (2, 2) Visual Cryptography Technique to Share Two Secrets

Table 5.2: Possibilities of subpixel patterns for black pixel in secret image B
Recovered
Secret The corre­ Subpixel by
The corre­ Modified
Pixel sponding Overlapping
Three Selected sponding Patterns in
in Patterns in Share 1 and Contrast
Subpixel Patterns Patterns in Flipped
Image Flipped Modified
Share 1 Share 2
B Share 2 Flipped
Share 2

0%

25%

0%

25%

0%

0%

RIRD, Satara, Shivaji University, Kolhapur 48


5.3 Design of (2, 2) Improved Contrast Visual Cryptography Technique

5.3 Design of (2, 2) Improved Contrast Visual Cryptogra­


phy Technique
The traditional VC suffers from loss of contrast in the recovered image. The recovered
secret image is having 50% contrast as compared to the original secret image. This loss in
contrast occurs because a white pixel is not perfectly recovered as white, instead it is 50%
black and 50% white. The basis matrices used in traditional (2, 2) VCS are as shown in
equation 5.2.
   
1 1 0 0 0 0 1 1
W1 =   B1 =   (5.2)
1 1 0 0 1 1 0 0
The matrix W1 is used for generating a subpixel pattern for sharing a white secret pixel
whereas matrix B1 is used for sharing a subpixel pattern for sharing a black secret pixel.
These basis matrices generate subpixel patterns as shown in figure 5.5.

Figure 5.5: Subpixel patterns generated using basis matrices from equation 5.2

For sharing a white secret pixel, any one pattern from figure 5.5 is selected for all
the shares whereas for a black secret pixel, opposite patterns are shared. To improve the
contrast of recovered secret image, the basis matrices are modified. Instead of having two
matrices, six different matrices are used. These matrices are as shown in equation 5.3 and
equation 5.4.
   
1 0 0 0 1 0 0 0
W2 =   B2 =   (5.3)
1 0 0 0 0 1 1 1
   
1 1 1 0 1 1 1 0
W3 =   B3 =   (5.4)
1 1 1 0 0 0 0 1

RIRD, Satara, Shivaji University, Kolhapur 49


5.3 Design of (2, 2) Improved Contrast Visual Cryptography Technique

Table 5.3: Possible patterns for white secret pixel using W1 matrix
Possible Possible
Recovered
Secret patterns patterns
Matrix Selected Secret Contrast
Pixel for Share for Share
Pixel
1 2

 
1 1 0 0
W1 =   50%
1 1 0 0

If the columns of these matrices are permuted, then different patterns can be generated
for both shares. With these new patterns the contrast of a subpixel pattern can be either
0%, 25%, 50% or 75%. The detailed process of the technique is described below.
Consider a binary image as shown in figure 5.6 with a black pixel at left top corner and
white pixel at right top corner. When a black pixel from secret image is to be shared, then
any matrix out of B1 , B2 and B3 will be selected randomly. Let us assume that B2 matrix

RIRD, Satara, Shivaji University, Kolhapur 50


5.3 Design of (2, 2) Improved Contrast Visual Cryptography Technique

Table 5.4: Possible patterns for white secret pixel using W2 matrix
Possible Possible
Recovered
Secret patterns patterns
Matrix Selected Secret Contrast
Pixel for Share for Share
Pixel
1 2

 
1 0 0 0
W2 =   75%
1 0 0 0

Figure 5.6: Sample secret image for the proposed technique

is selected. The columns of B2 matrix are permuted randomly. From this permuted matrix,
row 1 is used to share a subpixel to share 1 and
 row 2 is used
 to share a subpixel to share
0 1 0 0
2. After permuting columns of B2 , let B2 =  , so the subpixel pattern to be
1 0 1 1

shared at corresponding location in share 1 will be and for share 2 will be . When
share 1 and share 2 are overlapped, the patterns will also be overlapped and the resulting

RIRD, Satara, Shivaji University, Kolhapur 51


5.3 Design of (2, 2) Improved Contrast Visual Cryptography Technique

Table 5.5: Possible patterns for white secret pixel using W3 matrix
Possible Possible
Recovered
Secret patterns patterns
Matrix Selected Secret Contrast
Pixel for Share for Share
Pixel
1 2

 
1 1 1 0
W3 =   25%
1 1 1 0

subpixel will be . Thus the recovered subpixel is perfectly black. Now consider a white
secret pixel at top right of secret image. To encrypt this pixel, one matrix from W1 , W2 and
W3 must be selected randomly. Let us assume that matrix
 W3 is selected.
 The columns of
1 0 1 1
matrix W3 are randomly permuted. Let matrix W3 =  . The row 1 of matrix
1 0 1 1
W3 is used for sharing a subpixel pattern in share 1 and row 2 of the matrix is used for
sharing a subpixel pattern in share 2. The subpixel pattern to be shared in share 1 will be

and in share 2 will be . These two subpixel patterns will be overlapped when both

the shares are overlapped. Thus, the recovered subpixel pattern will be . This shows
that the contrast of the subpixel pattern is only 25% because only one white pixel is present
and remaining three are black pixels. For sharing a white secret pixel, a matrix from W1 ,
W2 and W3 is chosen. For W1 , W2 and W3 matrices, the contrast of recovered secret pixel

RIRD, Satara, Shivaji University, Kolhapur 52


5.3 Design of (2, 2) Improved Contrast Visual Cryptography Technique

is 50%, 75% and 25% respectively. The subpixel patterns for sharing white secret pixel
using matrices W1 , W2 and W3 are shown in tables 5.3, 5.4 and 5.5 respectively.
For sharing a black secret pixel, a matrix from B1 , B2 and B3 is chosen. For B1 , B2
and B3 matrices, the black secret pixel is perfectly recovered. The subpixel patterns for
sharing black secret pixel using matrices B1 , B2 and B3 are shown in tables 5.6, 5.7 and
5.8 respectively.

Table 5.6: Possible patterns for black secret pixel using B1 matrix
Possible Possible
Recovered
Secret patterns patterns
Matrix Selected Secret Contrast
Pixel for Share for Share
Pixel
1 2

 
1 1 0 0
B1 =   0%
0 0 1 1

RIRD, Satara, Shivaji University, Kolhapur 53


5.3 Design of (2, 2) Improved Contrast Visual Cryptography Technique

Table 5.7: Possible patterns for black secret pixel using B2 matrix
Possible Possible
Recovered
Secret patterns patterns
Matrix Selected Secret Contrast
Pixel for Share for Share
Pixel
1 2

 
0 0 0 1
B2 =   0%
1 1 1 0

In this technique, the contrast of recovered white secret pixel is variable. The contrast
can be 25%, 50% or 75%. If subpixels are recovered with 75% contrast, then it will improve
the contrast of the entire image. If the contrast of the subpixels is 50%, then the contrast of
the entire image will be similar to a traditional (2, 2) VCS. Even if the contrast of recovered
subpixel is 25%, it will not reduce the contrast of the entire image significantly. This is

because of the adjacent subpixel blocks. For example, if there is a subpixel pattern as

with 25% contrast and subpixel pattern with 75% contrast, which are placed adjacent
to each other, then the overall contrast of two blocks will be 50%. The Human Visual
System has a tendency to average out the contrast. The total number of black and white
pixels are same in both the blocks combined. The contrast of the entire recovered secret
image increases as compared to traditional (2, 2) VCS. The results of this technique are
described in chapter 6.

RIRD, Satara, Shivaji University, Kolhapur 54


5.4 Design of Pixel Expansion Reduction Algorithm

Table 5.8: Possible patterns for black secret pixel using B3 matrix
Possible Possible
Recovered
Secret patterns patterns
Matrix Selected Secret Contrast
Pixel for Share for Share
Pixel
1 2

 
1 1 1 0
B3 =   0%
0 0 0 1

5.4 Design of Pixel Expansion Reduction Algorithm


One of the major problems in VC is the pixel expansion. The dimensions of recovered se­
cret image are greater than the original secret image. The dimensions of the shares are also
greater than recovered secret image. Due to this, the memory space required for storage
of shares also increases. The data required for transmission of these shares increases and
hence the time required for transmission of the shares also increases. Because of change
in dimensions of recovered secret image, the aspect ratio also changes. To avoid change
in aspect ratio, the dimensions along both the directions are increased. Many people have
worked in the area of size invariant VC. Some of the techniques use XOR based VC to re­
duce the dimensions of recovered secret image but in such techniques, small computation
power is required to reveal the secret image. The proposed technique generates shares with­
out pixel expansion and for revealing the secret, computational power is also not required.

RIRD, Satara, Shivaji University, Kolhapur 55


5.4 Design of Pixel Expansion Reduction Algorithm

The algorithm that is proposed here can be applied on shares generated by any visual cryp­
tography scheme. The algorithm can act as a post processing step for generation of size
invariant shares. For making the dimensions of the shares equal to the dimensions of secret
image, bicubic interpolation algorithm is used. For scaling down the shares, we need a
weight matrix and an indices matrix. The explanation of the entire process is given below.
Suppose, if we have a 4x4 image and we want to shrink it by a factor of 2, then the output
image will be of 2x2. This scenario is clear from figure 5.7.

Figure 5.7: Sample input image and scaled output image by a factor of 2

Let the input space coordinates be denoted by ‘u’ and output space coordinates be de­
noted by ‘x’. The first two rows of the input image are converted to two pixels in the first
row of the output image and the remaining two rows of the input image are converted to
two pixels in the second row of the output image. If we just consider the first two rows,
then the mapping will be as shown in figure 5.8.

Figure 5.8: Mapping of the pixels in input and output image

The first two pixels from first row and second row of the input image are mapped to
single pixel in the output image. Similarly, the remaining two pixels from first row and
second row of input image are mapped to single pixel in the output image. From the figure

RIRD, Satara, Shivaji University, Kolhapur 56


5.4 Design of Pixel Expansion Reduction Algorithm

5.8, we can map input and output as shown in table 5.9.

Table 5.9: Mapping of input and output image indices


Input image index (u) Output image index (x)
0.5 0.5
2.5 1.5
4.5 2.5

In general, for any scale factor the relation between input image index and output image
index is given by,
x 1
u= + 0.5(1 − ) (5.5)
s s
Using the equation 5.5, we can create the indices matrix. This indices matrix tells us
which pixels from input image should be considered for performing interpolation. The
bicubic function is used for finding out the weight matrix. It gives the interpolation weight
of a sample based on how far it is from an interpolated point. The bicubic interpolation is
represented by the following equation,




 1.5x3 − 2.5x2 + 1, |x| ≤ 1


f = −0.5x3 + 2.5x2 − 4x + 2, 1 < |x| ≤ 2 (5.6)





0, otherwise

The bicubic function without any scale factor is shown in figure 5.9(a), when we scale
the image with a factor of 0.5 then the bicubic function stretches on both sides and its
amplitude decreases, it is shown using orange curve in figure 5.9(b). The curve is stretched
to occupy more neighboring pixels. This kernel function is centered at the point to be
interpolated. The interpolated value is the weighted sum of the discrete neighboring points
scaled by the value of interpolation function at those points. For a two dimensional input,
interpolation is done along one dimension and the result obtained is again interpolated along
the other dimension. After applying bicubic interpolation on the shares, the dimensions of
shares become same as that of the secret image and thus pixel expansion is removed. We
can essentially call this technique as size invariant visual cryptography technique.

RIRD, Satara, Shivaji University, Kolhapur 57


5.4 Design of Pixel Expansion Reduction Algorithm

(a) No scaling (b) With a scale factor of 0.5

Figure 5.9: Bicubic plots

The process of applying the bicubic algorithm is explained with the help of an example.
Consider a matrix A as shown in the equation 5.7. This matrix is to be resized by a factor
of 0.5, so that it will have the dimensions as exactly half of its current dimensions.
 
1 1 0 0
 
 
0 0 0 0
A= 

 (5.7)
0 0 0 0
 
0 0 0 0

According to the algorithm, first the indices of output matrix are found out, denoted by ‘x’.
The dimensions of the output matrix will be 2 × 2. Hence, the indices will be,

x = [1, 2]

From this the indices of the input matrix ‘u’ are calculated using the equation 5.5.

u = [1.5, 3.5]

The width of the bicubic kernel is set to 8, i.e. from ­4 to +4 as shown in figure 5.9(b). The
leftmost pixel that can be used in calculating the resized values is given by

kernelwidth
lef t = f loor(u − ) (5.8)
2
After calculating, the values obtained are

RIRD, Satara, Shivaji University, Kolhapur 58


5.4 Design of Pixel Expansion Reduction Algorithm

left = [­3 ­1]

The maximum number of pixels that can be included in the calculations is given by

P = ceil(kernelwidth) + 2 (5.9)

Here, P = 8 + 2 = 10. For generating the indices matrix, the values of left and P are used.
The array of maximum number of pixels is created as shown below
 
0 1 2 3 4 5 6 7 8 9
 
0 1 2 3 4 5 6 7 8 9

For considering the index of leftmost pixel that can be used in calculation, the value of left
is added to the above array to generate the indices matrix.
 
−3 −2 −1 0 1 2 3 4 5 6
indices =  
−1 0 1 2 3 4 5 6 7 8

For calculating the weights matrix, the input coordinates ‘u’, indices matrix and the bicubic
function is used. The intermediate matrix ‘xw’ is generated by subtracting every element
of indices matrix from ‘u’. The matrix ‘xw’ is as shown below
 
4.5 3.5 2.5 1.5 0.5 −0.5 −1.5 −2.5 −3.5 −4.5
xw =  
4.5 3.5 2.5 1.5 0.5 −0.5 −1.5 −2.5 −3.5 −4.5

The weights matrix is calculated using the equation

weights = scale × bicubickernel(scale × xw) (5.10)

The scale used in this algorithm is 0.5 and the bicubic algorithm is as shown in the equation
5.6. First, the values in ‘xw’ matrix are multiplied by the scale factor, then for each value
in ‘xw’, the bicubic function value is calculated. Finally, every element in the ‘xw’ matrix
is multiplied by scale factor to get the final weights matrix.
 
2.25 1.75 1.25 0.75 0.25 −0.25 −0.75 −1.25 −1.75 −2.25
xw × scale =  
2.25 1.75 1.25 0.75 0.25 −0.25 −0.75 −1.25 −1.75 −2.25

 
0 −0.0117 −0.0352 0.1133 0.4336 0.4336 0.1133 −0.0352 −0.0117 0
weights =  
0 −0.0117 −0.0352 0.1133 0.4336 0.4336 0.1133 −0.0352 −0.0117 0

RIRD, Satara, Shivaji University, Kolhapur 59


5.4 Design of Pixel Expansion Reduction Algorithm

For calculating the output pixel value from kth row of output matrix, kth row of indices
matrix and kth row of weights matrix is used. Now the indices matrix is having indices
which are out of bound i.e. the indices are not present in the input image matrix. Such
indices are removed by using symmetric padding. Here, the input matrix is having 4 indices
only, so the elements those are greater than 4 and elements having negative values will be
removed and instead of them symmetric padding is done. The resultant indices matrix is
as shown below  
4 3 2 1 1 2 3 4 4 3
indices =  
2 1 1 2 3 4 4 3 2 1
The weights matrix is having some elements with 0 value, those can be removed along
with the corresponding elements from indices matrix. The final values in the indices and
weights matrix are as shown below
 
3 2 1 1 2 3 4 4
indices =  
1 1 2 3 4 4 3 2
 
−0.0117 −0.0352 0.1133 0.4336 0.4336 0.1133 −0.0352 −0.0117
weights =  
−0.0117 −0.0352 0.1133 0.4336 0.4336 0.1133 −0.0352 −0.0117
The resizing is done, first along the rows of original image matrix. This generates an
intermediate matrix. Again same algorithm is applied on the intermediate matrix along
the columns. The first row of the indices matrix is considered for calculating the values
in first row of the intermediate matrix. After that, values from the input matrix from first
column corresponding to the values in first row of indices matrix are taken in an array as
shown below.
 
0
 
 
0
 
 
1
 
  [ ]
1
B= 
  B′ = 0 0 1 1 0 0 0 0
0
 
 
0
 
 
0
 
0

RIRD, Satara, Shivaji University, Kolhapur 60


5.4 Design of Pixel Expansion Reduction Algorithm

The first row of the indices matrix is having indices from 1 to 4. The corresponding values
from first column of the input matrix are taken in the array B. The element by element
multiplication is done between the values in B and the first row of the weights matrix.
The resulting array is summed up and the resulting sum is placed as first element in the
intermediate matrix. When this process is repeated for all the columns in the input matrix,
it gives all elements in the first row of the intermediate matrix. The elements in the second
row of intermediate matrix are calculated using the second row of indices and weights
matrix. After this step, the intermediate matrix will have the rows equal to the output
matrix and columns equal to input matrix.
[ ]
weights. ∗ B ′ = 0 0 0.1133 0.4336 0 0 0 0

sum(weights.*B’) = 0.5469

 
0.5469 0.5469 0 0
intermediate matrix =  
−0.469 −0.469 0 0
Now the resizing of intermediate matrix is done along the columns to get the final resized
matrix. The first row of the indices matrix is having indices from 1 to 4. The corresponding
values from first row of the intermediate matrix are taken in the array B.
[ ]
B = 0 0.5469 0.5469 0.5469 0.5469 0 0 0

The element by element multiplication is done between the values in B and the first row of
the weights matrix.
[ ]
weights. ∗ B = 0 0 0.1133 0.4336 0 0 0 0

The resulting array is summed up and the resulting sum is placed as first element in the
final output matrix.
sum(weights. ∗ B) = 0.5170

When this process is repeated for all the rows in the input matrix, it gives all elements in the
first column of the output matrix. The elements in the second column of output matrix are

RIRD, Satara, Shivaji University, Kolhapur 61


5.5 Design of an Authentication System using Visual Cryptography

calculated using the second row of indices and weights matrix. After this step, the output
matrix will have the desired number of rows and columns.
 
0.5170 0.0299
Output M atrix =  
−0.0443 −0.0026

Using this algorithm the size of shares can be reduced and the problem of pixel expansion
can be solved. The results of this technique are described in chapter 6. This algorithm is
applied on a (2, 2) VCS and also on the proposed technique for contrast improvement.

5.5 Design of an Authentication System using Visual Cryp­


tography
The fourth objective of the research is to develop an authentication system using multiple
secret capability and improved contrast of recovered secret images. In this regard, a system
is developed to share two passwords using only two shares.
A particular application of this system is Secured Remote Paper Delivery (SRPD). The
SRPD system is currently being used in Shivaji University, Kolhapur (SUK). In the existing
system, the two 6­digit numeric passwords are sent on the registered mobile phone of the
institute. The first password is to download the paper from the SUK website. The second
password is to open the downloaded file. After that the question paper can be printed.

Figure 5.10: Number templates used for creating password images

RIRD, Satara, Shivaji University, Kolhapur 62


5.5 Design of an Authentication System using Visual Cryptography

(a) Password 1

(b) Password 2

Figure 5.11: Sample password images

In the proposed system, the two 6­digit passwords are generated and two shares of
those passwords are created. These shares can then be sent using email, to the designated
internal and external supervisors of that institute. These shares can then be given as input
to a software which will recover the two password from the shares. The first advantage
of this system is that both the supervisors should be present for downloading the question
paper and the second advantage is that instead of mobile phone the Internet will be used
to send passwords in the form of shares. The mobile phones may have network issues like
congestion etc. and the password may not be delivered. This problem can be eliminated
with the proposed system.
The proposed system is explained with the help of an example. Initially, two six digit
random numbers are generated. For generating the random numbers discrete uniform dis­
tribution function is used. This is to ensure that all the numbers have equal probability of
occurrence. The generated numbers are in the text format. These numbers are converted
into a single image using the pre­existing digit templates. Two images are generated for
two passwords, each image has dimensions of 80 × 300. The individual digit templates
have dimensions of 80 × 50 as shown in figure 5.10.
For instance, if the passwords generated are 297509 and 327418, then the corresponding
digit templates are used to create a single image for entire password. The two images
created will be as shown in figure 5.11(a) and 5.11(b).
The proposed technique of sharing two secrets using two shares is applied on the two

RIRD, Satara, Shivaji University, Kolhapur 63


5.5 Design of an Authentication System using Visual Cryptography

Figure 5.12: GUI for extracting passwords from shares

images and two shares are generated. The first share can be emailed to the internal su­
pervisor while the second share can be emailed to the external supervisor. These shares
should be downloaded by both the supervisors on the same computer. Then using a simple
software, the passwords can be extracted from these shares. Although the computer is not
required for decryption, but to avoid the printing of shares on transparent sheets, a computer
is used. When both the shares are overlapped, first password is revealed and when one of
the share is flipped and overlapped with another share, the second password is revealed.
The revealed passwords are not exactly recovered as original password images. To extract
the digits in the text format from the recovered password, a two dimensional correlation
is used. The correlation is computed using equation 5.11. Here, ‘m’ and ‘n’ are rows and
columns in the image, A and B are the two images which are to be compared, A and B are
the mean values of the images A and B respectively.
∑ ∑
(Amn − A)(Bmn − B)
r = √ ∑ ∑m n ∑ ∑ (5.11)
( m n (Amn − A)2 )( m n (Bmn − B)2 )

To extract the password digits from the recovered secret images, the recovered digits are
compared with the original digits using correlation. When the recovered secret digit matches

RIRD, Satara, Shivaji University, Kolhapur 64


5.5 Design of an Authentication System using Visual Cryptography

Table 5.10: Correlation values of recovered digit 3 with original sample digits
Recovered Digit Original Digit Correlation Value

0.0810

0.0065

0.0422

0.2333

0.0458

0.1331

0.1375

0.0648

0.1518

0.1366

the original secret digit, the correlation value is high. In this way, the text password is iden­
tified from the recovered secret images. The correlation values for sample recovered secret
digit 3 and the original template digits are shown in the table 5.10. The highest correlation
value occurs for digit 3 and it is 0. 2333. For other digits the correlation values are far
less than 0.2333. The correlation values are calculated for all the recovered secret digits
of the passwords and the text password is extracted. The screenshot of the GUI used for
extracting the password is shown in the figure 5.12. In the GUI, the share 1 and share 2 are
browsed and after clicking on begin button, the passwords are extracted from the shares

RIRD, Satara, Shivaji University, Kolhapur 65


5.6 Image Quality Metrics

and displayed on the screen.

5.6 Image Quality Metrics


For calculating some of the image quality metrics, the original and recovered secret images
are required along with some other parameters. The parameters that are calculated are True
Positive (NTP), True Negative (NTN), False Positive (NFP) and False Negative (NFN)
pixels with respect to both original and recovered secret images. Here, true positive means
a black pixel in the Original Secret Image (OSI) is recovered as black in Recovered Secret
Image (RSI). True negative means black pixel is recovered as white, false positive means
white pixel in OSI recovered as white in RSI and false negative means a white pixel is
recovered as black.

1. Peak Signal to Noise Ratio (PSNR)


The PSNR is a measure of the peak error between the OSI and RSI. The PSNR can
be calculated as,
(M ax value)2
P SN R = 10 × log10 (5.12)
M SE
where, ∑
− I2 (m, n)]2
M,N [I1 (m, n)
M SE =
M ×N
Here, I1 and I2 are OSI and RSI, respectively. M and N are the dimensions of the
images. For binary images, Max value = 1.

2. Structural Similarity Index (SSIM)


The quality of image can be accessed using SSIM. The image may have spatial and
non­stationary features, hence while applying SSIM it must be applied locally rather
than on the entire image. The distortions in image may not be space invariant. The
detailed information about the quality of image can be obtained since SSIM is applied
locally. The degradation of structural information in the image is evaluated by SSIM.

(2µx µy + C1 )(2σxy + C2 )
SSIM (x, y) = (5.13)
(µ2x + µ2y + C1 )(σx2 + σy2 + C2 )

RIRD, Satara, Shivaji University, Kolhapur 66


5.6 Image Quality Metrics

Where, µx is the average of x, µy is the average of y, σx2 is the variance of x, σy2 is the
variance of y, σxy and is the covariance of x and y. Parameters C1 and C2 are used
to stabilize the division. When the OSI and RSI are similar, then the value of SSIM
is nearly equal to 1.

3. Negative Rate Matrix (NRM)


The pixel­wise difference between OSI and RSI is calculated as follows

N Rf n + N Rf p
N RM = (5.14)
2

where,
NF N
N Rf n =
NF N + NT P
NF P
N Rf p =
NF P + NT P
If the value of NRM is nearly equal to 0, then it means that there is very less difference
between OSI and RSI.

4. Sensitivity

NT P
Sensitivity = (5.15)
NT P + NF N
If the value of sensitivity is nearly equal to 1, then it indicates that OSI and RSI are
similar.

5. Precision

NT P
P recision = (5.16)
NT P + NF P
If the value of precision is nearly equal to 1, then the difference between OSI and
RSI is very less.

6. FM easure
2 × Recall × P recision
FM easure = (5.17)
Recall + P recision
The value of FM easure close to 1 indicates that the OSI and RSI are similar.

RIRD, Satara, Shivaji University, Kolhapur 67


5.6 Image Quality Metrics

7. Specificity
NT N
Specif icity = (5.18)
NT N + NF P
If the value of specificity is nearly equal to 1, then the difference between OS and
RSI is very less.

8. Balanced Classification Rate (BCR)

BCR = 0.5 × (Specif icity + Sensitivity) (5.19)

If the value of BCR is nearly equal to 1, then it indicates that the difference in the
OSI and RSI is less.

9. Distance Reciprocal Distortion Measure (DRDM)


The distortion in binary images can be measured objectively by a metric proposed
in [107]. A weight matrix Wm having center pixel coordinates as ic and jc , is required
for this metric, Wm is given by,



0, if ic = jc
Wm (i, j) = 1


√ , otherwise
(i − ic ) + (j − jc )2
2

The normalized form of matrix Wm is as shown below,


Wm (i, j)
WN m (i, j) = ∑m ∑m
i=1 j=1 Wm (i, j)
If a pixel which changed from black in OSI to white in RSI or white in OSI to black
in RSI, is considered as a distortion in the binary image. The distortion is calculated
for every altered pixel S in the RSI.

DRDk = [Dk (i, j) × WNm (i, j)]
i,j

The difference matrix Dk is calculated as,

Dk (i, j) = |Bk (i, j) − Rk (i, j)|

Where Bk (i, j) is the n × n block centered at (i, j) in OSI and Rk (i, j) is the n × n
block centered at (i, j) in RSI. The DRD is given by,
∑s
DRDk
DRD = k=1 (5.20)
N U BN
Where NUBN is the number of non­uniform 8 × 8 blocks in the OSI.

RIRD, Satara, Shivaji University, Kolhapur 68


5.7 Chapter Conclusion

10. Geometric Accuracy (GA)


In [112], a metric is developed which checks whether the recovered secret pixel is of
correct colour or not. The GA is calculated as,

b w
GA = × (5.21)
B W

Where, w is the number of white pixels correctly detected as white in RSI, b is the
number of black pixels correctly detected as black in RSI, and B and W are the total
number of black and white pixels in the OSI.

5.7 Chapter Conclusion


This chapter has discussed the detailed system design of all the techniques that have been
developed. The problem of sharing more than one secrets is solved using the proposed (2,
2) VC technique which uses only two shares for sharing two secrets. In this technique,
the first secret is revealed by stacking the share 1 and share 2 as it is, while for revealing
the second secret the share 2 is flipped horizontally and stacked on the share 1. The other
advantage of this technique is that the secret images to be encrypted can have different
dimensions. The only condition is that the smaller image must be completely inscribed
inside the larger image. One of the major problems in VC is contrast degradation, this
problem is solved using the proposed (2, 2) VC technique using three different basis ma­
trices to encrypt the secret pixels. This technique helps to improve the overall contrast of
the recovered secret image, although the individual recovered secret pixel contrast may be
variable and it can take any value between 0%, 25%, 50% and 75%. Thus, the black and
white secret pixels can be recovered with any of these values. Another major problem in
VC is of pixel expansion. This problem of pixel expansion is solved using the bicubic al­
gorithm. The bicubic algorithm helps to reduce the dimensions of recovered secret image
along both the rows and columns. This algorithm can be applied on the shares generated
using any VC technique. This algorithm can act as the post­processing step for many VC
techniques. Finally, an authentication system is developed to share passwords for down­
loading and opening an exam question paper. This system generates two 6­digit random

RIRD, Satara, Shivaji University, Kolhapur 69


5.7 Chapter Conclusion

numeric passwords and these passwords are shared using two shares. In this system two
of the proposed techniques are used. First, a (2, 2) VC technique to share two secrets and
second, a (2, 2) VC technique to improve the contrast of recovered secret image. A GUI is
developed to take the generated shares as input and extract the two passwords from them.

RIRD, Satara, Shivaji University, Kolhapur 70

You might also like