예제 #1
0
        private void rotationToolStripMenuItem_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 rot = new InputBox("Rotation Angle", numberTextBox);

            rot.ShowDialog();
            if (rot.DialogResult == DialogResult.OK)
            {
                int   ang = Convert.ToInt32(rot.ValueTextBox.Text);
                float rad = Convert.ToSingle(Math.PI / 180.0 * ang);

                ImageClass.Rotation(img, img.Copy(), rad);

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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #2
0
        private void rotationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // clock cursor
            float angleRad = 0;

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

            InputBox form = new InputBox("Qual o valor do ângulo a rodar?");

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

            angleRad = (float)(Math.PI / 180) * angle;

            ImageClass.Rotation(img, imgUndo, angleRad);

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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #3
0
        private void RotationToolStripMenuItem_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("Degrees:");

            input.ShowDialog();
            double degrees = Convert.ToDouble(input.ValueTextBox.Text);

            //convert to rads
            double rad_degrees = degrees * Math.PI / 180;

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

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

            ImageClass.Rotation(img, imgCopy, rad_degrees);

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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #4
0
        private void rotationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //copy Undo Image
            imgUndo = img.Copy();

            InputBox form = new InputBox("Anglo");

            form.ShowDialog();
            float angle = Convert.ToSingle(form.ValueTextBox.Text);

            ImageClass.Rotation(img, img, angle);
        }
예제 #5
0
        private void rotationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)
            {
                return;
            }

            Cursor = Cursors.WaitCursor; // clock cursor

            InputBox angleForm = new InputBox("Angle?");

            angleForm.ShowDialog();
            float angle = (float)Convert.ToDecimal(angleForm.ValueTextBox.Text);

            //copy Undo Image
            imgUndo = img.Copy();
            ImageClass.Rotation(img, imgUndo, angle);

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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #6
0
        private void rotationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null)             // verify if the image is already opened
            {
                return;
            }
            Cursor = Cursors.WaitCursor;             // clock cursor

            InputBox form = new InputBox("Input angle (Deg)");

            form.ShowDialog();
            float angle = (float)ImageClass.ConvertDegreesToRadians(double.Parse(form.ValueTextBox.Text));

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

            ImageClass.Rotation(img, imgUndo, angle);

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

            Cursor = Cursors.Default;          // normal cursor
        }
예제 #7
0
        private void RotationToolStripMenuItem_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 formr = new InputBox("Rotation (degrees)?");

            formr.ShowDialog();
            int   degrees = Convert.ToInt32(formr.ValueTextBox.Text);
            float radian  = degrees * (float)Math.PI / 180;

            ImageClass.Rotation(img, imgUndo, radian);

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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #8
0
        private void rotationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            float Angle;

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

            InputBox frame = new InputBox("Rotation Angle");

            frame.ShowDialog();
            Cursor = Cursors.WaitCursor; // cursor relogio
            try
            {
                Angle = float.Parse(frame.ValueTextBox.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("Please insert float values!");
                Cursor = Cursors.Default; // cursor normal
                return;
            }

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

            ImageClass.Rotation(imgUndo, img, Angle);

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

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

            InputBox form = new InputBox("rotate");

            form.ShowDialog();
            double rot = Convert.ToInt64(form.textBoxBright.Text);

            Cursor = Cursors.WaitCursor; // clock cursor

            imgUndo = img.Copy();
            ImageClass.Rotation(img, imgUndo, rot);
            //copy Undo Image


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

            Cursor = Cursors.Default; // normal cursor
        }
예제 #10
0
        //Draw Rectangle Iterative
        private void digitsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // verify if the image is already opened
            {
                return;
            }


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



            Cursor = Cursors.WaitCursor; // clock cursor
            float angleRad = 0;
            int   angle    = 6;

            int[] matrix = new int[4];  //[xf,xi,yf,yi]
            angleRad = (float)(Math.PI / 180) * angle;
            float treshold = 5;


            ImageClass.ConvertToBW_Otsu(img);
            ImageClass.Negative(img);
            imgCopia = img.Copy();
            ImageClass.Rotation(img, imgCopia, angleRad);
            imgCopia = img.Copy();
            ImageClass.Border(img);
            imgCopia = img.Copy();
            matrix   = ImageClass.RectangleIterative(img, treshold);

            //[xf,xi,yf,yi]
            Point bc_centroid1 = new Point(0, 0);

            bc_centroid1.X = matrix[1]; //(matrix[0] - matrix[1])/2;
            bc_centroid1.Y = matrix[3]; //(matrix[2] - matrix[3])/2;


            Size bc_size1 = new Size(0, 0);

            bc_size1.Width  = Math.Abs((matrix[0] - matrix[1]));
            bc_size1.Height = Math.Abs((matrix[2] - matrix[3]));

            string bc_image1  = "ola";
            string bc_number1 = "ola";

            Point bc_centroid2 = new Point(0, 0);

            bc_centroid2.X = 0;
            bc_centroid2.Y = 0;

            Size bc_size2 = new Size(0, 0);

            bc_size2.Width  = 0;
            bc_size2.Height = 0;

            string bc_image2  = "ola";
            string bc_number2 = "ola";


            ImageClass.BarCodeReader(img, ImageType(), out bc_centroid1, out bc_size1, out bc_image1, out bc_number1, out bc_centroid2, out bc_size2, out bc_image2, out bc_number2);


            //ImageClass.BarCodeReader(img, 0, out Point1, new Size (190,71), "imagem", "number", new Point(95, 36), new Size(190, 71), "imagem2", "number2");

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

            Cursor = Cursors.Default; // normal cursor
        }