Ejemplo n.º 1
0
        //string OpenedFilePath2;

        private void btnOpen_Click(object sender, EventArgs e)
        {
            if (!checkBox2.Checked)
            {
                OpenFileDialog openFileDialog1 = new OpenFileDialog();
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    //Open the browsed image and display it
                    string OpenedFilePath = openFileDialog1.FileName;
                    ImageMatrix = ImageOperations.OpenImage(OpenedFilePath);
                    ImageOperations.DisplayImage(ImageMatrix, pictureBox1);
                }
                txtWidth.Text  = ImageOperations.GetWidth(ImageMatrix).ToString();
                txtHeight.Text = ImageOperations.GetHeight(ImageMatrix).ToString();
            }
            else
            {
                OpenFileDialog openFileDialog1 = new OpenFileDialog();

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    //Open the browsed image and display it

                    string OpenedFilePath = openFileDialog1.FileName; //filepath

                    Stopwatch sw = Stopwatch.StartNew();


                    ImageMatrix = ImageOperations.Decompress_image(OpenedFilePath, ref seed, ref tap, ref height, ref width);
                    ImageOperations.DisplayImage(ImageMatrix, pictureBox1);
                    sw.Stop();
                    text_seed.Text         = seed;
                    text_tap.Text          = tap.ToString();
                    txtHeight.Text         = height.ToString();
                    txtWidth.Text          = width.ToString();
                    btnGaussSmooth.Enabled = true;
                    MessageBox.Show("Decompression time: " + ((double)sw.ElapsedMilliseconds / 1000).ToString() + " seconds");
                    //label1.Text = "Encrypted Image";
                }
            }
        }