Пример #1
0
        /// <summary>
        /// Efectua o negativo da imagem
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void negativeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (img == null) // protege de executar a função sem ainda ter aberto a imagem
            {
                return;
            }
            Cursor = Cursors.WaitCursor; // cursor relogio

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

            ImageClass.Negative(img);

            ImageViewer.Refresh();    // atualiza imagem no ecrã

            Cursor = Cursors.Default; // cursor normal
        }
Пример #2
0
        /// <summary>
        /// Calculate the image negative
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void negativeToolStripMenuItem_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.Negative(img);

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

            Cursor = Cursors.Default; // normal cursor
        }
Пример #3
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
        }