Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.Filter           = @"Imagen|*.jpg;*.jpeg;*.jpe;*.jfif;*.png;*.gif;*.ico;*.tif;*.tiff;*.bmp";
            fileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            fileDialog.Title            = @"Porfavor seleccione una imagen.";
            DialogResult result = fileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                actualImage    = (Bitmap)Image.FromFile(fileDialog.FileName);
                actualPixels   = KernelController.GetBitMapColorMatrix(actualImage);
                picture1.Image = Image.FromFile(fileDialog.FileName);
                picture2.Image = Image.FromFile(fileDialog.FileName);

                kernel.SelectedIndex = 8;
                filter.SelectedIndex = 0;

                showComponents();
                fileLabel.Text = fileDialog.SafeFileName;
            }
            else
            {
                MessageBox.Show(@"Error al leer el archivo.");
            }
        }
Example #2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int selectedIndex = filter.SelectedIndex;

            //Select filter

            // 0 -> Default
            // 1 -> Black and White
            // 2 -> Sepia

            switch (selectedIndex)
            {
            case 0:
                picture2.Image = actualImage;
                break;

            case 1:
                picture2.Image = PictureController.convertToGrayScale(actualImage);
                break;

            case 2:
                picture2.Image = PictureController.convertToSepia(actualImage);
                break;

            default:
                picture1.Image = actualImage;
                picture2.Image = actualImage;
                break;
            }

            actualPixels = KernelController.GetBitMapColorMatrix((Bitmap)picture2.Image);

            kernel.SelectedIndex = 8;
        }