Esempio n. 1
0
        private void buttonNext_Click(object sender, EventArgs e)
        {
            if ((textBoxSample.Text == String.Empty) && (textBoxQuantize.Text == String.Empty))
                MessageBox.Show("Especifica algún valor para el muestreo o la cuantización");
            else
            {
                ImageForm digitalImage = new ImageForm();
                digitalImage.MdiParent = this.MdiParent;

                if ((textBoxSample.Text != String.Empty) && (textBoxQuantize.Text != String.Empty))
                {
                    digitalImage.samplingImage(bmp_, Convert.ToInt32(textBoxSample.Text));
                    digitalImage.quantizationImage(digitalImage.getPicture(), Convert.ToInt32(textBoxQuantize.Text));
                }
                else
                    if (textBoxQuantize.Text != String.Empty)
                        digitalImage.quantizationImage(bmp_, Convert.ToInt32(textBoxQuantize.Text));
                    else
                        if (textBoxSample.Text != String.Empty)
                            digitalImage.samplingImage(bmp_, Convert.ToInt32(textBoxSample.Text));

                digitalImage.Show();

            }
        }
Esempio n. 2
0
 public void createImageTrame(int[] dat, int ntrames)
 {
     ImageForm Image2 = new ImageForm();
     Image2.MdiParent = this;
     Image2.Text = "Imagen por tramos";
     Image2.loadTrames(dat, ntrames, p_);
     Image2.Show();
     writePanel();
 }
Esempio n. 3
0
 /// <summary>
 /// crear form con la imagen con el brillo y el contraste modificados
 /// </summary>
 /// <param name="dat"></param>
 /// <param name="ntrames"></param>
 public void createImageBC(double b, double c, double newb, double newc)
 {
     ImageForm Image2 = new ImageForm();
     Image2.MdiParent = this;
     Image2.Text = "Imagen brillo y contraste modificados";
     Image2.loadbc(b, c, newb, newc, p_);
     Image2.Show();
     writePanel();
 }
Esempio n. 4
0
 private void buttonNext_Click_1(object sender, EventArgs e)
 {
     if ((textBoxT.Text != String.Empty) && (textBoxT.Text != "0"))
     {
         t_ = (Convert.ToInt32(textBoxT.Text));
         ImageForm i = new ImageForm();
         i.MdiParent = this.MdiParent;
         i.DifferencePart2(bmpo_, bitmapToDifference_, t_);
         i.Show();
     }
 }
Esempio n. 5
0
        private void buttonNext_Click(object sender, EventArgs e)
        {
            if ((textBoxGamma.Text != String.Empty) && (textBoxGamma.Text != "0"))
            {

                ImageForm image = new ImageForm();
                image.MdiParent = this.MdiParent;
                image.Gamma(Convert.ToDouble(textBoxGamma.Text), bmp_);
                image.Show();
            }
        }
Esempio n. 6
0
 private void buttonNext_Click(object sender, EventArgs e)
 {
     if (textBoxRotation.Text != String.Empty)
     {
         ImageForm image = new ImageForm();
         image.MdiParent = this.MdiParent;
         image.rotationValue(bmp_, Convert.ToDouble(textBoxRotation.Text), comboBoxMethod.SelectedItem.ToString());
         image.Show();
     }
     else
         MessageBox.Show("Indique un valor para la rotación");
 }
Esempio n. 7
0
        private void buttonNext_Click(object sender, EventArgs e)
        {
            if ((textBoxX.Text != String.Empty) || (textBoxY.Text != String.Empty))
            {
                double newScaleWidth = bmp_.Width;
                double newScaleHeight = bmp_.Height;

                if (textBoxX.Text != String.Empty)
                   newScaleWidth = bmp_.Width * (Convert.ToDouble(textBoxX.Text) / 100);
                if (textBoxY.Text != String.Empty)
                   newScaleHeight = bmp_.Height * (Convert.ToDouble(textBoxY.Text) / 100);

                if (comboBoxMethod.SelectedItem != null)
                {
                   ImageForm image = new ImageForm();
                   image.MdiParent = this.MdiParent;
                   if (String.Equals(comboBoxMethod.SelectedItem.ToString(), "Bilineal"))
                   {
                    image.bilinealEscalating(bmp_, (int)newScaleWidth, (int)newScaleHeight,
                    (Convert.ToDouble(textBoxX.Text) / 100), (Convert.ToDouble(textBoxY.Text) / 100));

                    }
                    else
                    {

                       image.vmpEscalating(bmp_, (int)newScaleWidth, (int)newScaleHeight,
                       (Convert.ToDouble(textBoxX.Text) / 100), (Convert.ToDouble(textBoxY.Text) / 100));
                    }

                    image.Show();
                }
                else
                    MessageBox.Show("Selecciona algún método de interpolación");
            }
            else // first if
                MessageBox.Show("Selecciona algún valor de escalado");
        }
Esempio n. 8
0
        public void HistogramSpecification(String dir, double[] ho, Bitmap bmpo)
        {
            OpenImage(dir);
            int m = 256;
            double[] po = new double[m];
            double[] pr = new double[m];
            /*
            if ((bmpo.Width != width_) || (bmpo.Height != height_))
            {
                for (int i = 0; i < m; i++)
                {
                    po[i] = ho[i] / (bmpo.Height*bmpo.Width);
                    pr[i] = R_[i] / (width_ * height_);
                }
            }

            for (int i = 1; i < m; i++)
            {
                po[i] = (ho[i] + po[i - 1]) ;
                pr[i] = (R_[i] + pr[i - 1]);
             }
            */
            double n1 = 0; // imagen original
            double n2 = 0; // imagen referencia
            for (int i = 0; i < 256; i++)
            {
                n1 += ho[i];
                n2 += R_[i];
            }
            double c1 = 0;
            double c2 = 0;
            for (int i = 0; i < 256; i++)
            {
                c1 += ho[i];
                c2 += R_[i];
                po[i] = c1 / n1;
                pr[i] = c2 / n2;
            }

            double[] lut = new double[256];
            int j = m - 1;
            for (int i = 0; i <= 255; i++)
            {
                j = m - 1;
                do
                {
                    lut[i] = j;
                    j--;
                } while ((j>=0) && (po[i] <= pr[j]));

            }

            ImageForm SpecificationImage = new ImageForm();
            SpecificationImage.MdiParent = this.MdiParent;
            Bitmap SpecificationBmp= new Bitmap(bmpo);

            for (int x = 0; x < bmpo.Width; x++)
            {
                for (int y = 0; y < bmpo.Height; y++)
                {

                    int temp = (int)lut[bmpo.GetPixel(x, y).R];
                    Color Grey = Color.FromArgb(temp, temp, temp);
                    SpecificationBmp.SetPixel(x, y, Grey);
                }
            }
            SpecificationImage.AssignAtributtes(SpecificationBmp);
            SpecificationImage.Show();
        }
Esempio n. 9
0
        public void Ecualization()
        {
            double k = (width_ * height_)/256;
            double[] C = new double[256];
            double[] lut = new double[256];
            C[0] = R_[0];
            for (int i = 1; i < 256; i++)
            {
                C[i] = (R_[i] + C[i - 1]);

            }
            for (int i = 0; i <= 255; i++)
            {
                lut[i] = Math.Max(0, (Math.Round(C[i] / k) - 1));

            }

            ImageForm EcualizationImage = new ImageForm();
            EcualizationImage.MdiParent = this.MdiParent;
            Bitmap EcualizationBmp = new Bitmap(picture_);

            for (int x = 0; x < width_; x++)
            {
                for (int y = 0; y < height_; y++)
                {

                    int temp = (int)lut[picture_.GetPixel(x, y).R];
                    Color Grey = Color.FromArgb(temp, temp, temp);
                    EcualizationBmp.SetPixel(x, y, Grey);
                }
            }
            EcualizationImage.AssignAtributtes(EcualizationBmp);
            //SpecificationImage.pictureBox1.Image = (Image)(SpecificationBmp);
            EcualizationImage.Show();
        }
Esempio n. 10
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (seleccionar)
            {
                PuntoFin = new Point(e.X, e.Y);
                int anchoRectangulo = PuntoFin.X - PuntoInicio.X;
                int  alturaRectangulo = PuntoFin.Y- PuntoInicio.Y;
                Rectangle RectanguloSeleccion = new Rectangle(PuntoInicio.X, PuntoInicio.Y, anchoRectangulo, alturaRectangulo);
                Graphics objGrafico = this.pictureBox1.CreateGraphics();
                Pen pen = new Pen(Color.Red, 1);
                float[] valoresLineaDiscontinua = { 3, 2, 3, 2 };
                pen.DashPattern = valoresLineaDiscontinua;
                objGrafico.DrawRectangle(pen, RectanguloSeleccion);

                ImageForm smallImage = new ImageForm();
                smallImage.seleccion(this.picture_, PuntoInicio, PuntoFin, RectanguloSeleccion);
                smallImage.MdiParent = this.MdiParent;
                smallImage.Show();
            }
        }
Esempio n. 11
0
        //metodo para ejecutar el filtro
        private void buttonNext2_Click(object sender, EventArgs e)
        {
            bool allvalues = true;
            double[,] kernel = new double[Convert.ToInt32(textBoxRows.Text), Convert.ToInt32(textBoxColumns.Text)];

            int contadori = 0;
            int contadorj = 0;
            for (int i = 0; i < TextboxList.Count-1; i++) //menos uno por que el ultimo valor es el nombre del fichero
            {
               if (i % Convert.ToInt32(textBoxColumns.Text) == 0)
                  contadori = 0;
               if ((contadori == 0) && (i != 0))
                  contadorj += 1;
               if (TextboxList[i].Text == String.Empty)
               {
                   MessageBox.Show("Falta por introducir un valor");
                   allvalues = false;
                   break;
               }
               else
                  kernel[contadorj, contadori] = Convert.ToDouble(TextboxList[i].Text);
               contadori++;

             }
             if (allvalues == true)
             {
                ImageForm image = new ImageForm();
                image.MdiParent = this.MdiParent;
                image.applyFilter(bmp_, kernel, Convert.ToInt32(textBoxRows.Text), Convert.ToInt32(textBoxColumns.Text), Convert.ToDouble(textBoxNormalize.Text));
                image.Show();
             }
        }
Esempio n. 12
0
 /// <summary>
 ///  Rotación de 90
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ºToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         ImageForm Image1 = (ImageForm)ActiveMdiChild;
         ImageForm ImageRotation = new ImageForm();
         ImageRotation.MdiParent = this;
         ImageRotation.rotation90(Image1.getPicture());
         ImageRotation.Show();
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("No hay ninguna foto seleccionada");
     }
 }
Esempio n. 13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="formHijo"></param>
 private void monocromoToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     try
     {
         ImageForm Image1 = (ImageForm)ActiveMdiChild;
         ImageForm Image2 = new ImageForm();
         Image2.Text = "Imagen en monocromo";
         Image2.MdiParent = this;
         Image2.toMonocrom(Image1.getPicture());
         Image2.Show();
         writePanel();
     }
     catch (NullReferenceException)
     {
         MessageBox.Show("No hay ninguna foto seleccionada");
     }
 }
Esempio n. 14
0
        private void especificaciónHistogramaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                ImageForm Image1 = (ImageForm)ActiveMdiChild;
                OpenFileDialog OpenFile = new OpenFileDialog();
                OpenFile.Filter = " Archivos JPEG(*.jpg)|*.jpg| Archivos TIFF(*.tif, *.tiff)|*.tif; *.tiff";
                OpenFile.InitialDirectory = "C:\\Users\\Jose\\Desktop\\Imagenes";
                if (OpenFile.ShowDialog() == DialogResult.OK)
                {
                    ImageForm ImageForm = new ImageForm();
                    ImageForm.MdiParent = this;
                    ImageForm.Show();
                    String Dir = OpenFile.FileName;
                    ImageForm.Text = Dir;
                    ImageForm.HistogramSpecification(Dir, Image1.getR(), Image1.getPicture());
                    writePanel();

                }
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("No hay ninguna foto seleccionada");
            }
        }
Esempio n. 15
0
        private void abrirImagenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog OpenFile = new OpenFileDialog();
            OpenFile.Filter = " Archivos JPEG(*.jpg)|*.jpg| Archivos TIFF(*.tif, *.tiff)|*.tif; *.tiff";
            OpenFile.InitialDirectory = "C:\\Users\\Jose\\Desktop\\Imagenes";
            if (OpenFile.ShowDialog() == DialogResult.OK)
            {
                ImageForm ImageForm = new ImageForm();
                ImageForm.MdiParent = this;
                ImageForm.Show();
                String Dir = OpenFile.FileName;
                ImageForm.Text = Dir;
                ImageForm.OpenImage(Dir);
                writePanel();

            }
        }