Ejemplo n.º 1
0
        private void TranslationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            InputBox input = new InputBox("Dx:");

            input.ShowDialog();
            int trans_x = Convert.ToInt32(input.ValueTextBox.Text);


            input = new InputBox("Dy:");
            input.ShowDialog();
            int trans_y = Convert.ToInt32(input.ValueTextBox.Text);

            //copy Undo Image
            imgUndo = img.Copy();

            Image <Bgr, byte> imgCopy = img.Clone();

            ImageClass.Translation(img, imgCopy, trans_x, trans_y);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Ejemplo n.º 2
0
        private void TranslationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //copy Undo Image
            imgUndo = img.Copy();

            InputBox form = new InputBox("dX?");

            form.ShowDialog();
            int dx = Convert.ToInt32(form.ValueTextBox.Text);

            InputBox form2 = new InputBox("dY?");

            form2.ShowDialog();
            int dy = Convert.ToInt32(form2.ValueTextBox.Text);

            ImageClass.Translation(img, imgUndo, dx, dy);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Ejemplo n.º 3
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //copy Undo Image
            imgUndo = img.Copy();

            DoubleInputBox dib = new DoubleInputBox("X Translation:", "Y Translation:", "Translation", numberTextBox, numberTextBox);

            dib.ShowDialog();

            int dx = Convert.ToInt32(dib.textBox1.Text);
            int dy = Convert.ToInt32(dib.textBox2.Text);

            if (dib.DialogResult == DialogResult.OK)
            {
                ImageClass.Translation(img, img.Copy(), dx, dy);

                ImageViewer.Image = img.Bitmap;
                ImageViewer.Refresh(); // refresh image on the screen
            }

            Cursor = Cursors.Default; // normal cursor
        }
Ejemplo n.º 4
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)
            {
                return;
            }

            Cursor = Cursors.WaitCursor; // clock cursor
            InputBox dxForm = new InputBox("dx?");

            dxForm.ShowDialog();
            int dx = Convert.ToInt32(dxForm.ValueTextBox.Text);

            InputBox dyForm = new InputBox("dy?");

            dxForm.ShowDialog();
            int dy = Convert.ToInt32(dyForm.ValueTextBox.Text);

            //copy Undo Image
            imgUndo = img.Copy();
            ImageClass.Translation(img, imgUndo, dx, dy);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }

            InputBox form = new InputBox("translact");

            form.ShowDialog();
            int posX = Convert.ToInt32(form.textBoxBright.Text);
            int posY = Convert.ToInt32(form.textBoxConstrast.Text);

            Cursor = Cursors.WaitCursor; // clock cursor

            imgUndo = img.Copy();
            ImageClass.Translation(img, imgUndo, posX, posY);
            //copy Undo Image


            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Ejemplo n.º 6
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //copy Undo Image
            imgUndo = img.Copy();

            InputBox form = new InputBox("Coordenada x");

            form.ShowDialog();
            int dx = Convert.ToInt32(form.ValueTextBox.Text);

            InputBox form1 = new InputBox("Coordenada y");

            form1.ShowDialog();
            int dy = Convert.ToInt32(form1.ValueTextBox.Text);

            ImageClass.Translation(img, img, dx, dy);
        }
Ejemplo n.º 7
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor

            //copy Undo Image
            imgUndo = img.Copy();

            ImageClass.Translation(img, imgUndo, 100, 100);

            ImageViewer.Image = img.Bitmap;
            ImageViewer.Refresh();    // refresh image on the screen

            Cursor = Cursors.Default; // normal cursor
        }
Ejemplo n.º 8
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int Dx, Dy;

            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }

            TranslationBox frame = new TranslationBox();

            frame.ShowDialog();
            Cursor = Cursors.WaitCursor; // cursor relogio
            try
            {
                Dx = Int32.Parse(frame.DxTextBox.Text);
                Dy = Int32.Parse(frame.DyTextBox.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Please insert integer values!");
                Cursor = Cursors.Default; // cursor normal
                return;
            }

            //copy Undo Image
            imgUndo = img.Copy();
            DateTime d1 = DateTime.Now;

            ImageClass.Translation(imgUndo, img, Dx, Dy);

            ImageViewer.Refresh(); // atualiza imagem no ecrã
            DateTime d2 = DateTime.Now;

            Cursor = Cursors.Default; // cursor normal
            MessageBox.Show((d2 - d1).ToString());
        }
Ejemplo n.º 9
0
        private void translationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)             // verify if the image is already opened
            {
                return;
            }

            using (TranslationForm form = new TranslationForm())
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Cursor = Cursors.WaitCursor;                     // clock cursor
                    //copy Undo Image
                    imgUndo = img.Copy();

                    ImageClass.Translation(img, imgUndo, form.dx, form.dy);

                    ImageViewer.Image = img.Bitmap;
                    ImageViewer.Refresh();                     // refresh image on the screen

                    Cursor = Cursors.Default;                  // normal cursor
                }
            }
        }