public Form1()
        {
            InitializeComponent();

            //resultMatrix = new MMatrix();
            bSaveDone = true;
            InputMatrixForm = new FormMatrixInput();
            SystemOfEquationsForm = new FormSystemOfEquationsInput();
            ScalarForm = new FormScalarInput();
            NewRankForm = new FormNewRankInput();
            NoiseForDiscontinuityForm = new FormNoiseInput();
            CreateNoiseForm = new FormNoise();
            GaussForm = new FormGaussianSmooth();
            SharpenForm = new FormSharpening();
            ImageForm = new FormBitmapDisplay();
            FormHis = new FormHistogram();
            colordlg = new ColorDialog();
            ImgProcess = new ImageProcessing();

            for (int i = 1; i < 256; ++i)
            {
                toolStripSkeletonDiff.Items.Add(i);
                toolStripComboBoxSkeletonDiff.Items.Add(i);
            }
            colordlg.FullOpen = true;
            colordlg.ShowHelp = true;
            colordlg.AnyColor = true;
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
        }
        public Bitmap BitmapBitwise(Bitmap Bmp1, Bitmap Bmp2, string Operation)
        {
            ImageProcessing IP = new ImageProcessing();
            IP.MatrixFromBitmap(ref Bmp2);
            Bitmap bmp = new Bitmap(Bmp1);
            int cs, r3;
            Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
            BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);

            // Declare an array to hold the bytes of the bitmap.
            int bytes = bmpData.Stride * bmp.Height;
            byte[] rgbValues = new byte[bytes];

            // Copy the RGB values into the array. bmpData.Scan0 returns the address of the first line.
            Marshal.Copy(bmpData.Scan0, rgbValues, 0, bytes);

            if (Operation == "&")
                for (int column = 0; column < bmpData.Height; column++)
                {
                    cs = column * bmpData.Stride;
                    for (int row = 0; row < bmpData.Width; row++)
                    {
                        r3 = row * 3;
                        rgbValues[cs + r3] &= IP.MBlue[row, column];
                        rgbValues[cs + r3 + 1] &= IP.MGreen[row, column];
                        rgbValues[cs + r3 + 2] &= IP.MRed[row, column];
                    }
                }
            else if (Operation == "|")
                for (int column = 0; column < bmpData.Height; column++)
                {
                    cs = column * bmpData.Stride;
                    for (int row = 0; row < bmpData.Width; row++)
                    {
                        r3 = row * 3;
                        rgbValues[cs + r3] |= IP.MBlue[row, column];
                        rgbValues[cs + r3 + 1] |= IP.MGreen[row, column];
                        rgbValues[cs + r3 + 2] |= IP.MRed[row, column];
                    }
                }
            else //if (Operation == "^")
                for (int column = 0; column < bmpData.Height; column++)
                {
                    cs = column * bmpData.Stride;
                    for (int row = 0; row < bmpData.Width; row++)
                    {
                        r3 = row * 3;
                        rgbValues[cs + r3] ^= IP.MBlue[row, column];
                        rgbValues[cs + r3 + 1] ^= IP.MGreen[row, column];
                        rgbValues[cs + r3 + 2] ^= IP.MRed[row, column];
                    }
                }
            // Copy the RGB values back to the bitmap
            Marshal.Copy(rgbValues, 0, bmpData.Scan0, bytes);
            bmp.UnlockBits(bmpData);

            return bmp;
        }