Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 1

Performance of halftone visual cryptography via error
diffusion and halftone visual cryptography via direct
binary search

PRATIKSHA P.PATIL
K.I.Ts college of engineering, Kolhapur
E-mail: pratikshapatil22@gmail.com

Y. M. PATIL
K.I.Ts college of engineering, Kolhapur
E-mail: ymp2002@rediffmail.com

ABSTRACT

Visual cryptography is a powerful technique which combines the notions of perfect ciphers
and secret sharing in cryptography with that of raster graphics. An image can be divided
into few shares which can be stacked together to recover the original image.In this paper, a
novel technique which enables visual cryptography of binary images is presented. With the
use of halftoning and a novel micro block encoding scheme, the technique has a unique
flexibility which allows a single encryption of a binary image but allows different grayscale
images to act like the shares. The secret image is concurrently embedded into binary valued
shares while these shares are halftoned by error diffusion and direct binary search. The
decoded image is free from the information of the shares. Also a comparison of PSNR is
done in this paper.
Index Terms: Direct binary search, Error diffusion, halftone visual cryptography (HVC),
half toning, peak signal to noise ratio, visual cryptography (VC).

---------------------------------------------------------------------------
I. INTRODUCTION
Visual cryptography[2] was originally proposed for the
problem of secret sharing. Secret sharing is one of the early
problems to be considered in cryptography. In a (k, n)-
threshold problem, a secret is divided into n pieces. With
any k of the n pieces, the secret can be perfectly
reconstructed, while even complete knowledge of k -1
pieces reveals absolutely no information about the secret.
Visual Cryptography illustrated a new paradigm to solve the
(k, n) problem. It was originally proposed by Naor and
Shamir. The original scheme generates n images (known as
shares) based on the secret message (the original image)
which can be printed on n transparencies. The original
message can then be recovered if any k or more than k of the
transparencies are stacked together, but no information
about the original image can be gained if fewer than
threshold number of k transparencies are stacked. Visual
cryptography is a unique technique in the sense that the
encrypted messages can be decrypted directly by the human
visual system. Therefore, a system employing visual
cryptography can be used by anyone without any knowledge
of cryptography.

II. RESEARCH PROBLEM
Halftone visual cryptography [4]construction method
based on error diffusion[6] is implemented, which can
generate shares taking pleasing visual information. Halftone
visual cryptography can also be implemented by
simultaneously encoding the secret image and producing the
halftone shares via DBS[5]. Comparative study of these two
methods is done in this paper.

III. TWO-OUT-OF-TWO HALFTONE VISUAL
CRYPTOGRAPHY METHOD

Two out- of-two halftone visual threshold scheme is shown
in Fig.1. In this method, a halftone image I, obtained by
applying any halftoning method such as the error diffusion
algorithm[6] on a grey level image GI, is given to
participant 1, and its complementary image , obtained by
reversing all black/white pixels of to white/black pixels, is
given to participant 2. To encode a secret pixel into a
Q1Q2 halftone cell in each of the two shares, only two
pixels, referred to as the secret information pixels, in each
halftone cell need to be modified. The two secret
information pixels should be at the same positions in the two
shares, such as pixels A and B in Fig.1. If is white, M a
matrix is randomly selected from the matrices C0 and C1[2]
of conventional VC. If is black, is M randomly selected
from C1. The secret information pixels in the i
th
share are
replaced with the two subpixels in the i
th
row of M, as
shown in Fig1. Since C0 and C1[2] are the collections of
conventional VC, these modified pixels carry the encoded
Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 2

secret. The other pixels in the halftone cell which were not
modified are referred to as ordinary pixels, maintaining
halftone information.

Fig 1.Construction of a two-out-of-two method.

It can also be found that if p is white, one out of pixels in
the reconstructed halftone cell, obtained by superimposing
the two encoded halftone cells, is white while all other
pixels are black as shown in Fig. 2 (a) and (b). If p is black,
all pixels in the reconstructed halftone cell are black, as
shown in Fig.2(c) and (d). Thus, the contrast condition is
satisfied. The secret pixel can be visually decoded with
contrast (1/ Q1Q2). In the above procedure, the selection
of the secret information pixels in a halftone cell is
important as it affects the visual quality of the resultant
halftone shares. The simplest method to select the locations
of the secret information pixels is random selection. The
corresponding pixel replacements, however, are equivalent
to adding white noise, which leads to poor visual quality. To
obtain better visual results, the void and cluster algorithm
[6] is applied to choose these pixel locations.

Fig. 2 Matrix M is randomly selected (a), (b) from C0 if p=0, (c),
(d) from C1 if p=1 and SIPs are replaced with corresponding pixels
in M

The void and cluster algorithm, performed on a binary dither
pattern of the halftone cell, first applies a low-pass finite-
impulse response (FIR) filter to obtain a measure of
minority pixel density (m.p.d.) at each minority pixel
location. The minority pixel is white/black and the majority
pixel is black/white, if the halftone cell contains more
black/white pixels. The minority pixel with the highest
density, denoted as pixel, is replaced with a majority pixel.
The dither pattern is then filtered again by the same low-
pass FIR filter to obtain a measure of m.p.d. at each majority
pixel location. The majority pixel (different from pixel) with
the lowest density, denoted as pixel B, is then replaced with
a minority pixel. Since the complementary pair has the same
distribution of the minority and majority pixels, the located
pixels A and B are at the same positions in the two shares.
The void and cluster algorithm, identifies the minority pixel
A with the highest m.p.d. and the majority pixel B with the
lowest m.p.d., and switches their locations. This, in effect,
spreads the minority pixels as homogeneously as possible
leading to an improved blue noise halftone cell in each
share. The locations of the secret information pixels are then
chosen as that of the pixels A and B. Once the matrix M is
randomly selected, the j
th
located secret information pixel in
the i
th
share is replaced with the j
th
subpixel in the i
th
row of
M. The replacement in each share either keeps their original
values or switches them with equal probabilities. If the
values are kept original, the blue noise halftone cell,
generated by the error diffusion algorithm, is used, e.g., the
first halftone cell in Fig.2 (a) and (c), and the second
halftone cell in Fig. 2(b) and (c). On the other hand, if the
values are switched, the new blue noise halftone cell,
generated by the void and cluster algorithm, is used, e.g., the
first halftone cell in Fig. 2(b) and (d), and the second
halftone cell in Fig.2(a) and (d). Visually pleasing halftone
shares are thus obtained. In the void and cluster algorithm,
generally, the filter window covers multiple neighbouring
halftone cells besides the one currently being processed. If a
white secret pixel p=0 was encoded into one of the
neighbouring halftone cells, there is inconsistency in the
distribution of the minority/majority pixels between two
shares, such as Fig.2(a) and (b). If the conventional void and
cluster algorithm is performed on each share, it may result in
different locations of the secret information pixels in the two
shares, which is highly undesirable in the halftone VC
scheme.
To address this problem, a slightly modified void- and
cluster-finding filter, is used to find the m.p.d:


.(1)

where, DA(x, y) is the m.p.d. of the pixel with coordinate is
the filter, also called weighting function, W is the filters
window width, and P(x+p, y+q) is the pixel value at defined
as follows:

( )
{

( )

( )

( )


...(2)
Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 3

The Gaussian filter is used in as:

( )
(
(

)
........... (3)

where o is a scalar constant, offering best results at
in the void and cluster algorithm based on Ulichneys
simulations. Unlike the conventional void- and cluster-
finding filter, each secret information pixel in the previously
processed neighboring cells always takes the value 0.5 in
this method, regardless if it is a minority or majority pixel.
The value 0.5 is the statistical mean of each secret
information pixel, because it has equal probability to be a
minority or majority pixel. The above modification of the
void and cluster algorithm guarantees that the selection of
the secret information pixels A and B is independent of the
value of any secret information pixel in the previous
halftone cells. Thus, no secret can be inferred from the
locations of the secret information pixels which can be
detected by comparing the original halftone image and the
corresponding halftone share. In addition, since the values
of secret information pixels come from the basis matrices of
conventional VC, no secret can be obtained by looking at
the values of secret information pixels of one share either.
Thus, this halftone visual threshold scheme is fully secure.
The above proposed construction implements a two out- of-
two halftone VC scheme with a pixel expansion

and relative difference


( ), where the superscript h indicates that the


parameters are for halftone VC. Visually pleasing halftone
shares are generated by the blue noise halftoning techniques
and the secret image can be reconstructed by superimposing
the two shares. The peak signal-to-noise ratio (PSNR) of
each halftone share, compared to its original halftone image,
can be estimated as,

||

(4)
=
where, the item | |denotes the value difference of
switching a secret information pixel, the item

indicates
that two out of Q1Q2 pixels are secret information pixels,
and the item 50% indicates that each secret information
pixel is either unmodified or switched with equal
probabilities. Thus, the larger the halftone cell size, the
higher the PSNR. Also, better performance of the void and
cluster algorithm can be obtained in larger halftone cells,
leading to higher visual quality halftone shares. On the other
hand, the relative difference

( ) is proportional
to the reciprocal of the cell size. Smaller halftone cell sizes
lead to higher contrast of the decoded secret image.
Therefore, a tradeoff exists between the visual quality of the
halftone shares and the contrast of the reconstructed secret
image. Also, the share size is usually limited. If the number
of sub pixels is increased, the size of sub pixels becomes
smaller; this leads to difficulty of superimposing the
transparencies onto one another.
IV. HALFTONE VISUAL CRYPTOGRAPHY VIA ERROR
DIFFUSION

A. Share Structure
We have used this method in which, a share is also divided
into nonoverlapping halftone cells of size q . Over the q
pixels, pixels are SIPs that carry the secret visual
information. There are also x pixels that are forced to be
black (value 1). These black pixels are called auxiliary black
pixels (ABPs). ABPs are deliberately introduced into the
shares so that some ABPs on one share block the visual
information of the other shares. Thus, when qualified shares
are stacked together, only the secret visual information is
revealed.
An example of the halftone cells in a 2-out-of-2 scheme
using method 2 is shown in Fig.3 where the first and second
pixels in each cell are SIPs. The third pixel in share 1 and
the fourth pixel in share 2 are ABPs. When stacking two
shares together, the result is a white pixel with contrast . The
fourth pixel in share 1 and the third pixel in share 2 are
assigned values to carry visual information of the shares.
They can take value of 0 or 1, which will not affect the
decoded image. The SIPs are distributed as homogeneously
as possible and are maximally separated from each other.
The introduction of ABPs also brings additional
quantization error that should be diffused away. Thus the
ABPs should be distributed in the same way as SIPs.
Furthermore, there should be a sufficient number of ABPs in
the shares so that the visual information of one share is
completely blocked by the ABPs on the other shares.

Fig.3 Example of halftone cells
Since the ABPs are not designed to carry visual information,
the number of ABPs in a share is to be minimized as
follows.
Let p(i,j) = [p
1
(i,j), p
2
(i,j),.p
n
(i,j)]
T
be the vector
where p
l
(i, j) is the (i,j)th pixel of share l . If the (i ,j)th pixel
is non-SIP, there should be at least n-k+1 ABPs in p(i,j) so
that any k entries selected from p( i, j) contain at least one
ABP. In each halftone cell, there (q- ) are non-SIPs. Thus,
the optimal number of ABPs in a halftone cell is

( )..(5)

where returns the smallest integer that is no less than the
argument.

B. Generation of Halftone Shares
The actual values of the SIPs can be determined by
following ways:
After the distribution of SIPs is generated, the next step is to
assign the values to all the SIPs. This procedure only
depends on the underlying VC scheme. Under the 2-out-of-2
VC scheme, the basis matrices S
0
and S
1
are constructed
Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 4

first. Then we construct the matrix collections C
0
and C
1
from the basis matrices. For each SIPs of a halftone cell, a
matrix M is randomly selected from C
0
or C
1
depending on
the value of the corresponding secret image pixel . The SIPs
in the ith share are then replaced with the jth row of M . s
ij
,
the jth SIP in share , is set as s
ij=
M(I,j) . Thus, the locations
and the values of the SIPs are set before halftone shares are
actually generated. The basic computation required is linear
filtering followed by quantization.
The process of generating halftone shares via error diffusion
is shown in Fig.4, where the values of the SIPs are preset.
To produce the halftone share , a grayscale image is
provided.

Fig.4 Block diagram of HVC
Let f
i
(m,n)be the (m,n)
th
pixel of the grayscale image, then
the input to the threshold block is

( )

( ) ( )

( )

()
where, ( ) and H is a two-dimensional error filter.

is the quantization error at point (m,n). Assume the


threshold for the error diffusion is t
i
(m,n), then the output g
i
(m,n ) halftone pixel is 1, if

( ) ( ) ; or 0, if

( ) ( )
The quantization error is,

e
i
(i,j)= g
i
(m,n)-d
i
(m,n)(7)

The above procedure is applied only when is a non-SIP.
Otherwise, instead of simple thresholding, the value of the
output pixel is set equal to the value of the corresponding
predetermined SIP and the error is calculated as the
difference between the input to the thresholding block and
the SIP value. Since the SIPs are separated from each other,
the quantization error [6]caused by the introduction of the
SIPs is diffused away to the neighboring grayscale pixels, as
illustrated in Fig. and will not accumulate to cause visible
distortion. In this way, the SIPs are seamlessly embedded
into the halftone shares generated and the halftone share is
structured taking meaningful visual information.
For the ABPs, they are assigned value 1 (black). the pixels
other than ABPs and SIPs are assigned freely to carry the
share visual information. Once the assignments for the SIPs
and ABPs are determined, a halftoning algorithm can be
employed to produce the halftone shares from grayscale
images. The process of generating halftone shares via error
diffusion is similar to that shown in Fig.4 except that when
g
i
(m, n) is an SIP or ABP, instead of simple thresholding,
the value of the output pixel g
i
(m, n) is predetermined and
set as the value of corresponding SIP or ABP. However, we
still compute d
i
(m,n) by (6) and the quantization error
e(m,n) by (7) for SIPs and ABPs. The error caused by the
existence of the SIPs or ABPs is diffused away to the
neighboring grayscale pixels. Thus, the SIPs and ABPs are
embedded into the halftone shares naturally.

V. HALFTONE VISUAL CRYPTOGRAPHY VIA
DIRECT BINARY SEARCH

A. Basic principles
Unlike the two-step procedure namely, blue noise halftoning
and pixel replacing used for halftone visual cryptography,
we encode the secret image (pixel replacing) in the process
of image halftoning. In halftone VC, the original image for
each share is divided into cells of size Q1 Q2. The
positions and values of the secret information pixels in each
cell should satisfy the contrast and security conditions. The
secret information pixels are distributed as homogeneously
as possible in our method. For a given secret binary image,
we can randomly select a matrix M for each halftone cell
from C0 or C1 depending on the value of the secret pixel p
for that halftone cell. The secret information pixels of the
corresponding halftone cell in the ith share are replaced with
the ith row of M. Thus the locations and the values of the
secret information pixels in each halftone cell for each share
can be determined before any halftoning process. Since DBS
generally produces much better halftone image quality than
screening or error diffusion, we choose DBS[5] for the
subsequent halftoning process. Our objective is to minimize
the perceived errors between the continuous-tone images
and the halftone shares which encode the secret information
with respect to some specific HVS [9]model. Because of the
existence of the predetermined secret information pixels, the
operations in DBS are constrained, as will be explained
below.

B. DBS with secret pixel encoding

Direct binary search (DBS) uses a median filter to minimize
the perceived error between the continuous-tone image and
the output halftone image by searching for the best possible
configuration of the binary values in the halftone image
iteratively.
Median is an order filter[9],[10], it uses order statistics.
Given an NxN window h(m,n) with pixel (m,n) being the
midpoint of h, the pixel intensity values of pixels in W are
ordered from smallest to the largest.
Median filter selects the middle value as the value of (m,n).




The error between the continuous-tone image f (m;n) and the
halftone image g(m,n) is given by:
e(m,n) = g(m,n)- f (m,n)(8)
The perceptually filtered error is:
(m,n) = e(m,n)h(m;n).(9)
The error metric e is defined
as:
104 )) , ( (
85 88 95
104 114 100
104 110 110
) , ( =
(
(
(

= n m h Median n m h
Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 5

| ( )|

...(10)
In DBS , an initial halftone image g0(m,n) in which the
positions and values of the secret information pixels are
preserved is provided for a continuous-tone image f (m,n).
Then the algorithm evaluates the difference between f (m,n)
and g0(m,n) to produce the error image e(m,n) and filters
e(m,n) through the filter. The error metric e is evaluated for
the first time. Then the algorithm starts to evaluate changes
in the initial halftone image g0(m,n) that could lead to a
decrease in error . The main operations are toggle (change
the status of the current pixel) and swap (swap the values of
the current pixel and one of its 8 nearest neighboring pixels
that has a different value).
In our proposed method, the positions and values of the
secret information pixels for each halftone cell are
determined before the DBS[5] begins. So, they should not
be changed during the iterative search. If the current pixel
processed is a secret information pixel, toggle is forbidden.
If the current pixel or one of its 8 nearest neighboring pixel
is a secret information pixel, the swap between these two
pixels is also forbidden. The operation (toggle or swap) that
results in the greatest decrease in the error e is then
accepted. When all the pixels in the image have been
visited, the first iteration is over. The process is iteratively
repeated over the newly obtained halftone image until the
error e has converged to a local minimum. In this way, we
can produce a halftone share that has minimal difference
with respect to the original continuous-tone image in the
sense of HVS and also contains the secret image
information. The whole process is also illustrated in fig.5.
All the shares except the complementary share are produced
via DBS. The complementary image which is a structured
image but not a natural image is obtained by reversing all
pixels of its complementary pair except the secret
information pixels which are determined by the matrix M.
DBS on the natural image pair introduces noise on the
complementary share, but not on any other halftone shares.

Fig5. Block diagram of hvs via DBS
When all the secret information pixels are decided in each
share, we use DBS to produce a halftone image for each
share. Except the complementary share, all the shares can be
produced via this method.
V. RESULTS AND COMPARISON OF THE TWO METHODS
In this section we discuss the results and comparison of the
two methods.
Method 1
Fig 6 shows a binary secret image and three shares

Fig.6 Generating shares
Fig 7 shows embedding of secret image hello into shares

Fig.7 Embedding secret image into cover images
When we stack these three shares together we recover our
original image as shown in fig.8

Fig 8 Recovered image
Method 2
This is the secret image

Fig.9 secret image

Fig.10 cover image
Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 6


Fig. 11 share1

Fig 12 share 2

Thus, by stacking these two shares we get the secret image
as shown in fig.13

Fig.13 Recovered image

Our comparison parameter is PSNR[11] value of the
recovered image. We have taken various formats of the
secret image (eg.jpg, png, bmp, etc.) and calculated the
PSNR values of these images using the two methods.
Table 1 shows the comparison of two methods showing
different PSNR values.
VI. CONCLUSION
In this paper, HVC construction methods based on error
diffusion and direct binary search are implemented, which
can generate shares taking pleasing visual information. In
the proposed HVC constructions apply not only to VSS but
also to VSS uses in the context of visual authentication and
encryption. The contrast condition of the decoded image is
satisfied. Furthermore, the shares do not suffer any
interference from other shares. Simulations show that our
dbs method can produce much better halftone images for the
shares that show natural images compared with those
produced by halftone visual cryptography. The secret image
can be clearly decoded without showing any interference
with the share images.




Table 1 Comparison of two methods
Sr
no.
Image
format
of
secret
image

PSNR
value
using
DBS
(db)
PSNR value
using ERROR
DIFFUSION
(db)

1 Bmp 32.81 28.27
2 Jpg 32.81 22.02
3 Png 32.81 28.06
4 Tif 32.82 28.09
5 Gif 12.36 28.02

REFERENCES
1. G. Ateniese, C. Blundo, A. De Santis, and D.
R. Stinson, Extended capabilities for visual
cryptography, Theoret. Comput. Sci., vol.
250, no. 12, pp. 134161, 2001.
2. M. Naor and A. Shamir, Visual
cryptography, Adv. Cryptol.: EUROCRYPT,
Lecture Notes Comput. Sci., vol. 950, pp. 1
12, 1995.
3. Zhongmin Wang, Arce, G.R., Di Crescenzo,
G., "Halftone Visual Cryptography Via Error
Diffusion", Information Forensics and
Security, IEEE Transactions on, On page(s):
383 - 396 Volume: 4, Issue: 3, Sept. 2009
4. Z. Zhou , G. R. Arce and G. Di Crescenzo
"Halftone visual cryptography", IEEE Trans.
Image Process., vol. 15, pp.2441 2006
5. Zhongmin Wang, Gonzalo R. Arce and
Giovanni Di Crescenzo "Halftone visual
cryptography via direct binary search"14th
European Signal Processing Conference
(EUSIPCO 2006), Florence, Italy, September
4-8, 2006, copyright by EURASIP
6. Anshul Sharma Performance of error filters in
halftone Visual cryptography International
Journal on Cryptography and Information
Security (IJCIS),Vol.2, No.3, September 2012
7. Duo Jin, Wei-Qi Yan, Mohan S. Kankanhalli ,
"Progressive visual cryptography", SPIE
Journal of Electronic Imaging (JEI/SPIE) on
Nov.15, 2003, revised on Oct.26, 2004.
8. Bert W. Leung, Felix Y. Ng, and Duncan S.
Wong, "Security of a Visual Cryptography
Scheme for Color Images", Department of
Computer Science, City University of Hong
Kong, Hong Kong, China
9. Raymond H. Chan, Chung-Wa Ho, and Mila
Nikolova Salt-and-Pepper Noise Removal by
Median-type Noise Detectors and Detail-
preserving Regularization
10. Chin-Chen Chang ; Dept. of Inf. Eng. &
Comput. Sci., Feng Chia Univ., Taichung ; Ju-
Yuan Hsiao ; Chih-Ping Hsieh An Adaptive
Median Filter for Image Denoising Intelligent
Information Technology Application, 2008.
IITA '08. Second International Symposium on
(Volume:2 )
Proceedings of National Conference on Latest Advances, Trends in Electronic Science and Technology (LATEST - 2014)

Department of Electronics, Shivaji University, Kolhapur & Department of Electronics Engineering, KITs College of Engineering, Kolhapur Page 7

You might also like