Ejemplo n.º 1
0
        private static async Task GetResultsForContainerByLevel()
        {
            var items = (await DalService.GetAllResults()).Where(x =>
                                                                 x.Mode == (int)WatermarkingMode.OneContainerToAllKeysWithBrightness ||
                                                                 x.Mode == (int)WatermarkingMode.OneContainerToAllKeysWithContrast ||
                                                                 x.Mode == (int)WatermarkingMode.OneContainerToAllKeysWithNoise).ToList();

            foreach (var item in items)
            {
                item.ContainerFileName = item.ContainerFileName.Substring(0, item.ContainerFileName.IndexOf('_'));
            }


            foreach (var container in items.GroupBy(x => x.ContainerFileName))
            {
                Console.WriteLine(); Console.WriteLine();

                Console.WriteLine($"Results for {container.Key}");

                var brightnessResults = container.Where(x => x.Contrast == 0 && x.Noise == 0)
                                        .OrderBy(x => x.Brightness);
                Console.WriteLine($"Results per brightness");
                Console.WriteLine("Brightness - Encryption PSNR - Decryption PSNR - Encryption time - Decryption time - Key");
                foreach (var data in brightnessResults)
                {
                    Console.WriteLine("{0,8} {1,15} {2,15} {3,18} {4,18} {5,18}",
                                      data.Brightness, Math.Round(data.EncryptionPsnr, 2), Math.Round(data.DecryptionPsnr, 2),
                                      data.EncryptionTime.TotalMilliseconds, data.DecryptionTime.TotalMilliseconds, data.KeyFileName);
                }

                Console.WriteLine();
                var contrastResults = container.Where(x => x.Brightness == 0 && x.Noise == 0)
                                      .OrderBy(x => x.Contrast);
                Console.WriteLine($"Results per contrast");
                Console.WriteLine("Contrast - Encryption PSNR - Decryption PSNR - Encryption time - Decryption time - Key");
                foreach (var data in contrastResults)
                {
                    Console.WriteLine("{0,8} {1,15} {2,15} {3,18} {4,18} {5,18}",
                                      data.Contrast, Math.Round(data.EncryptionPsnr, 2), Math.Round(data.DecryptionPsnr, 2),
                                      data.EncryptionTime.TotalMilliseconds, data.DecryptionTime.TotalMilliseconds, data.KeyFileName);
                }

                Console.WriteLine();
                var noiseResults = container.Where(x => x.Brightness == 0 && x.Contrast == 0)
                                   .OrderBy(x => x.Noise);
                Console.WriteLine($"Results per noise");
                Console.WriteLine("Noise - Encryption PSNR - Decryption PSNR - Encryption time - Decryption time  -  Key");
                foreach (var data in noiseResults)
                {
                    Console.WriteLine("{0,8} {1,15} {2,15} {3,18} {4,18} {5,18}",
                                      data.Noise, Math.Round(data.EncryptionPsnr, 2), Math.Round(data.DecryptionPsnr, 2),
                                      data.EncryptionTime.TotalMilliseconds, data.DecryptionTime.TotalMilliseconds, data.KeyFileName);
                }

                Console.WriteLine("_______________________________________________________________________________________________________");
                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
        private static async Task GetResultsForSimpleMode()
        {
            var items = (await DalService.GetAllResults()).Where(x => x.Mode == 3 || x.Mode == 4).ToList();

            Console.WriteLine();
            Console.WriteLine("Red - Green - Blue - Encryption PSNR - Decryption PSNR - Encryption time - Decryption time - Name");
            Console.WriteLine();
            foreach (var item in items)
            {
                item.ContainerFileName = item.ContainerFileName.Substring(0, item.ContainerFileName.IndexOf('_'));
                Console.WriteLine("{0,4} {1,5} {2,5} {3,18} {4,18} {5,16} {6,17} {7,20}",
                                  item.AverageRedColor, item.AverageGreenColor, item.AverageBlueColor,
                                  Math.Round(item.EncryptionPsnr, 2), Math.Round(item.DecryptionPsnr, 2),
                                  item.EncryptionTime.TotalMilliseconds, item.DecryptionTime.TotalMilliseconds,
                                  item.ContainerFileName);
            }
        }
Ejemplo n.º 3
0
        private static async Task GetResultsForDiffContrastAndBrightness()
        {
            var items = (await DalService.GetAllResults()).Where(x => x.Mode == 1 || x.Mode == 2).ToList();

            foreach (var item in items)
            {
                item.ContainerFileName = item.ContainerFileName.Substring(0, item.ContainerFileName.IndexOf('_'));
            }


            foreach (var container in items.GroupBy(x => x.ContainerFileName))
            {
                Console.WriteLine(); Console.WriteLine();

                Console.WriteLine($"Results for {container.Key}");

                var brightnessResults = container.Where(x => x.Contrast == 0)
                                        .OrderBy(x => x.Brightness);
                Console.WriteLine($"Results per brightness");
                Console.WriteLine("Brightness - Encryption PSNR - Decryption PSNR - Encryption time - Decryption time");
                foreach (var data in brightnessResults)
                {
                    Console.WriteLine("{0,8} {1,15} {2,15} {3,18} {4,18}",
                                      data.Brightness, Math.Round(data.EncryptionPsnr, 2), Math.Round(data.DecryptionPsnr, 2),
                                      data.EncryptionTime.TotalMilliseconds, data.DecryptionTime.TotalMilliseconds);
                }

                Console.WriteLine();
                var contrastResults = container.Where(x => x.Brightness == 0)
                                      .OrderBy(x => x.Contrast);
                Console.WriteLine($"Results per contrast");
                Console.WriteLine("Contrast - Encryption PSNR - Decryption PSNR - Encryption time - Decryption time");
                foreach (var data in contrastResults)
                {
                    Console.WriteLine("{0,8} {1,15} {2,15} {3,18} {4,18}",
                                      data.Contrast, Math.Round(data.EncryptionPsnr, 2), Math.Round(data.DecryptionPsnr, 2),
                                      data.EncryptionTime.TotalMilliseconds, data.DecryptionTime.TotalMilliseconds);
                }
            }
        }