public void Extract_message_from_stego_image()
        {
            string path = Path.Combine(basePath, "hided.jpg");
            using (var stream = new StreamReader(path))
            {
                var reader = new JpegImageIO();
                var bytes = reader.ReadRGBFromImage(stream.BaseStream);
                //TestHelper.PrintMatrix("Stego img", bytes);

                var matrix = YCrCb.Parse(bytes);
                //TestHelper.PrintMatrix("Luminance Coeff", matrix);

                var dct = new DCT();
                //dct.Subsample(matrix);
                dct.CalculateDCT(matrix);
                //TestHelper.PrintMatrix("DCT", matrix);

                new Quantizer().ApplyQuantization(matrix, qf);
               // TestHelper.PrintMatrix("QDCT", matrix);

                var stego = new Steganography();
                var message = stego.ExtractMessage(matrix);

                Console.WriteLine(message);
            }
        }
        public void Matrix_is_the_same_when_DCT_and_IDCT_are_aplied()
        {
            var matrix = convertToYCrCb(new double[,]
                                            {
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                                {26, 26, 26, 25, 25, 25, 26, 26},
                                            });

            var expectedMatrix = MatrixUtil.Copy(matrix);

            DCT dct = new DCT();
            TestHelper.PrintMatrix("DCT", matrix);

            dct.CalculateDCT(matrix);
            TestHelper.PrintMatrix("DCT", matrix);
            dct.CalculateIDCT(matrix);

            var doubleExpectedMatrix = convertToDouble(expectedMatrix);
            var doubleMatrix = convertToDouble(matrix);
            CollectionAssert.AreEquivalent(doubleExpectedMatrix, doubleMatrix);
        }
        public void EmbedData(string path, byte[] message)
        {
            using (var stream = new StreamReader(path))
               {
               var imageIo = new JpegImageIO();
               var bytesRGB = imageIo.ReadRGBFromImage(stream.BaseStream);

               var matrix = YCrCb.Parse(bytesRGB);

               var dct = new DCT();
               dct.CalculateDCT(matrix);

               Quantizer q = new Quantizer();

               q.ApplyQuantization(matrix, Qf);

               var stego = new Steganography();
               stego.HideMessage(matrix, message);

               q.ApplyInverseQuantization(matrix, Qf);

               dct.CalculateIDCT(matrix);

               string pathToSave = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path) + "_stego.jpg");

               imageIo.WriteRGBToImage(pathToSave, RGB.Parse(matrix));
               }
        }
        public byte[] ExtractData(string path)
        {
            using (var stream = new StreamReader(path))
               {
               var reader = new JpegImageIO();
               var bytes = reader.ReadRGBFromImage(stream.BaseStream);

               var matrix = YCrCb.Parse(bytes);

               var dct = new DCT();
               dct.CalculateDCT(matrix);

               new Quantizer().ApplyQuantization(matrix, Qf);

               var stego = new Steganography();

               return stego.ExtractMessage(matrix);
               }
        }