Exemple #1
0
        private void stretchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenedPicture st = new OpenedPicture(picture.Image, "Stretch of " + _name, _parent);

            st.MdiParent = _parent;
            Bitmap             img    = new Bitmap(picture.Image);
            Image <Gray, Byte> strech = new Image <Gray, byte>(img);

            double[] minValue, maxValue;
            Point[]  minLocation;
            Point[]  maxLocation;
            strech.Mat.MinMax(out minValue, out maxValue, out minLocation, out maxLocation);
            for (int i = strech.Rows - 1; i >= 0; i--)
            {
                for (int j = strech.Cols - 1; j >= 0; j--)
                {
                    double newVal = (strech[i, j].Intensity - minValue.First()) * ((255 / maxValue.First()) - minValue.First());
                    strech[i, j] = new Gray(newVal);
                }
            }

            st.picture.Image = strech.Bitmap;
            st.Show();
            st.histogramToolStripMenuItem1_Click(sender, e);
        }
Exemple #2
0
        private void equaliseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenedPicture eq = new OpenedPicture(picture.Image, "Eqalization of " + _name, _parent);

            eq.MdiParent = _parent;
            Bitmap             img      = new Bitmap(picture.Image);
            Image <Gray, Byte> equalize = new Image <Gray, byte>(img);

            equalize._EqualizeHist();
            eq.picture.Image = equalize.Bitmap;
            eq.Show();
            eq.histogramToolStripMenuItem1_Click(sender, e);
        }