Exemplo n.º 1
0
 private void button52_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("Convolution");
         int[,] kernel =
         {
             {  2, -1,  2 },
             { -1, 10, -1 },
             {  2, -1,  2 }
         };
         int[,] kernel2 =
         {
             { 0,  0,  0,  0, 0 },
             { 0,  2,  0,  2, 0 },
             { 0, -1,  2, -1, 0 },
             { 0,  2, -1,  2, 0 },
             { 0,  0, -1,  0, 0 }
         };
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.Convolution(actual, kernel, 4);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 2
0
        private void button54_Click(object sender, EventArgs e)
        {
            try
            {
                anterior = MethodImagenFilter.CopyBitmap(actual);

                for (int j = 0; j < 4; j++)
                {
                    actual = MethodImagenFilter.BrightnessCorrection(actual);

                    for (int i = 0; i < 5; i++)
                    {
                        actual = MethodImagenFilter.ContrastCorrection(actual);
                    }
                }
                actual            = MethodImagenFilter.ContrastCorrection(actual);
                actual            = MethodImagenFilter.TirarBordaTRF4(actual);
                actual            = MethodImagenFilter.RetirarBolinha(actual);
                pictureBox1.Image = actual;
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Erro: {ex.Message}");
            }
        }
Exemplo n.º 3
0
 private void button47_Click(object sender, EventArgs e)
 {
     try
     {
         MethodImagenFilter.CorrigirTransparencia(actual, fileName);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 4
0
 private void button57_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("aumentar");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.ResizeNearestNeighbor(actual, actual.Width * 2, actual.Height * 2);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 5
0
 private void button28_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("Tirar Pixel Branco Só");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.PintarBrancoEntrePretos(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 6
0
 private void button49_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("Median2");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.Median2(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 7
0
 private void button31_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("EngrossarLinhas");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.engrossarLinhaPreto(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 8
0
 private void button27_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("Colorido para Branco");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.PintarPixelPretoDeBranco(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 9
0
 private void button44_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("tirar 2");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = actual.Clone(new Rectangle(0, 0, actual.Width, actual.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
         actual            = FA_Tirar2PixelsPretosEntreBrancos(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 10
0
 private void button35_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("TirarPretoSozinhoHorizontal");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = actual.Clone(new Rectangle(0, 0, actual.Width, actual.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
         actual            = MethodImagenFilter.TirarPixelPretoSozinhoHorizontal(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 11
0
 private void button33_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("Remover Cores");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = actual.Clone(new Rectangle(0, 0, actual.Width, actual.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
         actual            = MethodImagenFilter.RetirarTodasAsCoresEColocarNaImagemFinal(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 12
0
 private void button55_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("TRT21");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = MethodImagenFilter.TirarBordaTRT21(actual);
         actual            = MethodImagenFilter.PintarPixelPretoDeBranco(actual);
         actual            = MethodImagenFilter.Opening(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 13
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         if (actual != null && original != null)
         {
             actual            = MethodImagenFilter.CopyBitmap(original);
             pictureBox1.Image = actual;
             ZerarMudanca();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 14
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         if (actual != null && anterior != null)
         {
             actual            = MethodImagenFilter.CopyBitmap(anterior);
             pictureBox1.Image = actual;
             RemoverMudanca();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 15
0
        public static Task <string> GetResquest()
        {
            Task <string> task = Task.Run(() =>
            {
                string Resp = null;

                try
                {
                    DirectoryInfo dir = new DirectoryInfo(@"C:\DataCaptcha");

                    Bitmap image1 = new Bitmap(dir.FullName + "\\55499\\0f645d1d-7f21-45df-a2e8-adaf5e00159a.jpg");

                    Parallel.ForEach(dir.GetDirectories(), (currentDir, stateDir) =>
                    {
                        Parallel.ForEach(currentDir.GetFiles(), (currentFile, stateFile) =>
                        {
                            Bitmap image2 = new Bitmap(currentFile.FullName);

                            float Similarity = MethodImagenFilter.GetSimilarity(image1, image2);

                            if (Similarity > 0.95f)
                            {
                                Resp = currentFile.FullName;

                                stateDir.Break();
                                stateFile.Break();
                            }
                            else if (Similarity < 0.50f)
                            {
                                stateFile.Break();
                            }
                        });
                    });
                }
                catch (Exception ex)
                {
                    Resp = null;
                }

                return(Resp);
            });

            return(task);
        }
Exemplo n.º 16
0
 private void button75_Click(object sender, EventArgs e)
 {
     try
     {
         InsertarCambio("Pegar Azul");
         anterior          = MethodImagenFilter.CopyBitmap(actual);
         actual            = actual.Clone(new Rectangle(0, 0, actual.Width, actual.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb);
         actual            = MethodImagenFilter.PegarAzul(actual);
         actual            = MethodImagenFilter.PintarPixelPretoDeBrancoTRT17(actual);
         actual            = MethodImagenFilter.PintarBrancoEntrePretos(actual);
         actual            = MethodImagenFilter.TirarPixelSozinho(actual);
         actual            = MethodImagenFilter.Erosion(actual);
         actual            = MethodImagenFilter.Median(actual);
         pictureBox1.Image = actual;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 17
0
 private void MethodsImagenFilterReceita()
 {
     try
     {
         int[,] kernel =
         {
             {  2, -1,  2 },
             { -1, 10, -1 },
             {  2, -1,  2 }
         };
         actual = MethodImagenFilter.Closing(actual);
         actual = MethodImagenFilter.Convolution(actual, kernel, 2);
         actual = MethodImagenFilter.TirarBorda(actual);
         actual = MethodImagenFilter.RetirarTodasAsCoresEColocarNaImagemFinal(actual);
         actual = MethodImagenFilter.engrossarLinhaPreto(actual);
         actual = MethodImagenFilter.FA_TirarPixelPretoSozinhoNaHorizontal(actual);
         actual = MethodImagenFilter.FA_TirarPixelPretoSozinhoNaVertical(actual);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }
Exemplo n.º 18
0
 private void openFileDialog_FileOk(object sender, CancelEventArgs e)
 {
     try
     {
         Bitmap image = new Bitmap(openFileDialog1.FileName);
         if (image != null)
         {
             ZerarMudanca();
             System.IO.FileInfo fi = new System.IO.FileInfo(openFileDialog1.FileName);
             fileName              = fi.FullName;
             original              = new Bitmap(openFileDialog1.FileName);
             anterior              = MethodImagenFilter.CopyBitmap(original);
             actual                = MethodImagenFilter.CopyBitmap(original);
             resultado.Text        = string.Empty;
             gbFiltros.Enabled     = true;
             gbTratamentos.Enabled = true;
         }
         pictureBox1.Image = image;
     }
     catch (Exception ex)
     {
         MessageBox.Show($"Erro: {ex.Message}");
     }
 }