# Integrating Visual Cryptography for Efficient and Secure Image Sharing on Social Networks
## 4 Experimental Results
### Experiment Setup  
Our experiments are conducted on an Intel NUC machine equipped with an Intel Core i7 CPU and 4 GB of RAM (Random Access Memory). The experimental code was primarily written in Python, a widely used high-level programming language favored by researchers for its simplicity and robust library support. In the experiments, we utilized the OpenCV library for image processing, as well as the NumPy and SciPy libraries for numerical computations. These libraries provided the necessary tools and functions for image encryption and performance evaluation.  
We first explore and compare the encryption effects of different VC algorithms, particularly for grayscale and classic image encryption. As shown in Figure 2, we evaluate the performance of our algorithm, random-grid [20], probabilistic [7], and ED algorithms [21] through a series of stacking experiments. Each algorithm is adjusted for grayscale levels \(g=\frac{1}{8},\frac{2}{8},\frac{4}{8},\frac{6}{8},\frac{7}{8}\). The random-grid encryption employs a random-grid method for encryption and generates a more uniform encryption pattern but may lack precision in details. The probability-based encryption takes into account more statistical features when generating encrypted images. We also include images of an airplane, baboon, Barbara, boat, pepper, butterfly, and houses for testing, as they are representative of image processing. Unlike some existing methods that have only demonstrated encryption effects on character images or simplistic patterns, we have taken a more holistic approach. Our qualitative experiments include a variety of classic images. This allows for a more thorough evaluation of our method's performance and its applicability across different types of images.  
In addition to the qualitative comparative experiments mentioned earlier, we also conducted quantitative comparative experiments. We take the peak signal-to-noise ratio (PSNR), SSIM, and Normalized Absolute Error (NAE) as perceptual metrics to evaluate the proposed method. PSNR is a measure of the similarity between the original image and the compressed or processed image. As shown in Equation (10), it calculates the mean square error and converts it into decibel units to represent the relative signal-to-noise ratio between the images. SSIM is a metric that measures the similarity between two images which is defined in Equation (8). Compared to PSNR, SSIM aligns more closely with human visual perception in evaluating image quality. We take the PSNR on blurred versions of grayscale and halftone images to evaluate tone preservation. PSNR is used for Gaussian blurred (kernel \(\delta=2\)) grayscale and halftone image pairs. NAE is a metric used to assess the quality of reconstructed images. SSIM evaluates the accuracy of a reconstructed image by comparing the pixel-level differences between the original and reconstructed images. NAE calculates the average absolute error between the two images and normalizes it by comparing the pixel-level differences between the original and reconstructed images.  
Figure 2: Stacking results for kinds of VCSs. Each column corresponds to one algorithm and each row corresponds to one gray level. From left to right are our algorithm, random-grid, probabilistic, and error diffusion-based VCSs. From bottom to top are gray levels \(g=\frac{1}{8},\frac{2}{8},\frac{4}{8},\frac{6}{8},\frac{7}{8}\).  
the total number of pixels in the original image. A lower NAE value indicates that the reconstructed image closely resembles the original image, indicating higher reconstruction quality. To simulate the image preprocessing steps, we first remap the gray levels of images to half and then obtain an ED image as a benchmark for comparison.  
\[PSNR=20\cdot\log_{10}\left(\frac{MAX_{I}}{\sqrt{MSE}}\right) \tag{10}\] \[NAE(x,y)=\frac{\sum_{i,j}\left|x_{i,j}-y_{i,j}\right|}{\sum_{i,j}x _{i,j}} \tag{11}\]