コード例 #1
0
        private void tresholding()
        {
            Bitmap bitmap = new Bitmap(imageWindow.getImage());

            histoTab = new int[2];

            for (int x = 0; x < bitmap.Width; x++)
            {
                for (int y = 0; y < bitmap.Height; y++)
                {
                    Color c = bitmap.GetPixel(x, y);
                    if (c.R <= bottomValueTrackBar.Value)
                    {
                        bitmap.SetPixel(x, y, Color.FromArgb(0, 0, 0));
                        histoTab[0]++;
                    }
                    else
                    {
                        bitmap.SetPixel(x, y, Color.FromArgb(255, 255, 255));
                        histoTab[1]++;
                    }
                }
            }

            pictureBox1.Image = bitmap;
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            chart1.Series["Series1"].Points.AddXY(0, histoTab[0]);
            chart1.Series["Series1"].Points.AddXY(1, histoTab[1]);
        }
コード例 #2
0
        private void grayscaleReduction()
        {
            Bitmap bm = new Bitmap(imageWindow.getImage());

            for (int x = 0; x < bm.Width; x++)
            {
                for (int y = 0; y < bm.Height; y++)
                {
                    Color c      = bm.GetPixel(x, y);
                    var   points = chartDrawing.Series["Series1"].Points;
                    for (int i = 0; i < points.Count - 1; ++i)
                    {
                        if (c.R >= points[i].XValue && c.R <= points[i + 1].XValue)
                        {
                            int   q     = Convert.ToInt32(points[i].YValues[0]);
                            Color color = Color.FromArgb(255, q, q, q);
                            bm.SetPixel(x, y, color);
                        }
                    }
                }
            }

            pictureBox.Image = bm;
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox.Image, maxBmpLevel);
        }
コード例 #3
0
 public void setNewImage(Image image)
 {
     pictureBox1.Image = image;
     maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     HistogramOperations.clearHistogram(chart1);
     histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
 }
コード例 #4
0
        public LinearOperations(ImageWindow imageWindow)
        {
            InitializeComponent();
            this.imageWindow = imageWindow;

            foreach (NumericUpDown numericUpDown in numericUpDownPanel.Controls)
            {
                numericUpDown.Minimum = -20;
                numericUpDown.Maximum = 20;
            }

            imageMethodsComboBox.Items.Add("Wygładzanie K=1/9");
            imageMethodsComboBox.Items.Add("Wygładzanie K=1/10");
            imageMethodsComboBox.Items.Add("Wygładzanie K=1/16");
            imageMethodsComboBox.Items.Add("Wyostrzanie Maska 1");
            imageMethodsComboBox.Items.Add("Wyostrzanie Maska 2");
            imageMethodsComboBox.Items.Add("Wyostrzanie Maska 3");
            imageMethodsComboBox.Items.Add("Wyostrzanie Maska 4");
            imageMethodsComboBox.Items.Add("Wyostrzanie Maska 5");
            imageMethodsComboBox.Items.Add("Detekcja Krawędzi Maska 1");
            imageMethodsComboBox.Items.Add("Detekcja Krawędzi Maska 2");
            imageMethodsComboBox.Items.Add("Detekcja Krawędzi Maska 3");
            imageMethodsComboBox.SelectedIndex = 0;

            scalingMethodsComboBox.Items.Add("Metoda Proporcjonalna");
            scalingMethodsComboBox.Items.Add("Metoda Trójwartościowa");
            scalingMethodsComboBox.Items.Add("Metoda Obcinająca");
            scalingMethodsComboBox.SelectedIndex = 0;

            pictureBox1.Image = (Image)this.imageWindow.getImage().Clone();
            maxBMPValue       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            minBMPValue       = HistogramOperations.MinBmpLevel(pictureBox1.Image);
            //minBMPValue = 0;
            HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPValue);
        }
コード例 #5
0
        public GradientWindow(ImageWindow imageWindow)
        {
            InitializeComponent();
            this.imageWindow  = imageWindow;
            pictureBox1.Image = (Image)imageWindow.getImage().Clone();
            maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            minBMPLevel       = HistogramOperations.MinBmpLevel(pictureBox1.Image);
            HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);

            masksComboBox.Items.Add("Maska Robertsa");
            masksComboBox.Items.Add("Maska Sobela");
            masksComboBox.Items.Add("Maski Prewitta");
            masksComboBox.Items.Add("Maski Kirscha");
            masksComboBox.SelectedIndex = 0;

            scalingMethodsComboBox.Items.Add("Metoda Proporcjonalna");
            scalingMethodsComboBox.Items.Add("Metoda Trójwartościowa");
            scalingMethodsComboBox.Items.Add("Metoda Obcinająca");
            scalingMethodsComboBox.SelectedIndex = 0;

            directionComboBox.Items.Add("N");
            directionComboBox.Items.Add("S");

            directionComboBox.Visible = false;
            directionLabel.Visible    = false;
        }
コード例 #6
0
 private void ButtonReset_Click(object sender, EventArgs e)
 {
     pictureBox1.Image = bitmapCopy;
     acttualImage      = new Image <Gray, byte>(bitmapCopy);
     maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     HistogramOperations.clearHistogram(chart1);
     HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);
 }
コード例 #7
0
 private void previewButton_Click(object sender, EventArgs e)
 {
     operatioCalc();
     pictureBox1.Image = currentImage;
     HistogramOperations.clearHistogram(chart1);
     HistogramOperations.drawHistogram(chart1, pictureBox1.Image, HistogramOperations.MaxBmpLevel(pictureBox1.Image));
     acceptButton.Enabled = true;
 }
コード例 #8
0
 public LogicalWindow(ImageWindow imageWindow)
 {
     InitializeComponent();
     this.imageWindow  = imageWindow;
     pictureBox1.Image = (Image)imageWindow.getImage().Clone();
     maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);
 }
コード例 #9
0
 private void cancelButton_Click(object sender, EventArgs e)
 {
     initializeReductionChart((int)domainUpDown1.SelectedItem);
     HistogramOperations.clearHistogram(chart1);
     pictureBox.Image = (Image)imageWindow.getImage().Clone();
     histoTab         = HistogramOperations.drawHistogram(chart1, pictureBox.Image, maxBmpLevel);
     grayscaleReduction();
 }
コード例 #10
0
 public void setNewImage(Image image, int[] histTab)
 {
     pictureBox1.Image = image;
     maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     HistogramOperations.clearHistogram(chart1);
     histoTab = histTab;
     chart1.Series["Series1"].Points.AddXY(0, histoTab[0]);
     chart1.Series["Series1"].Points.AddXY(1, histoTab[1]);
 }
コード例 #11
0
        public void losMethodHisto()
        {
            int hAvg = 0;
            int R    = 0;
            int Hint = 0;

            int[] left     = new int[maxBmpLevel + 1];
            int[] right    = new int[maxBmpLevel + 1];
            int[] newValue = new int[maxBmpLevel + 1];

            for (int i = 0; i < histoTab.Length; i++)
            {
                hAvg += histoTab[i];
            }

            Bitmap bm = new Bitmap(pictureBox1.Image);

            hAvg = hAvg / 256;

            for (int Z = 0; Z < histoTab.Length; Z++)
            {
                left[Z] = R;
                Hint    = Hint + histoTab[Z];
                while (Hint > hAvg)
                {
                    Hint = Hint - hAvg;
                    R++;
                }
                right[Z]    = R;
                newValue[Z] = right[Z] - left[Z];
            }

            for (int x = 0; x < bm.Width; x++)
            {
                for (int y = 0; y < bm.Height; y++)
                {
                    Color c = bm.GetPixel(x, y);
                    if (left[c.R] == right[c.R])
                    {
                        Color color = Color.FromArgb(255, left[c.R], left[c.R], left[c.R]);
                        bm.SetPixel(x, y, color);
                    }
                    else
                    {
                        Random rnd   = new Random();
                        int    los   = rnd.Next(0, newValue[c.R]);
                        Color  color = Color.FromArgb(255, left[c.R] + los, left[c.R] + los, left[c.R] + los);
                        bm.SetPixel(x, y, color);
                    }
                }
            }

            pictureBox1.Image = bm;
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
        }
コード例 #12
0
 public ImageWindow(Image image, string name)
 {
     InitializeComponent();
     Text              = name;
     _image            = image;
     pictureBox1.Image = image;
     maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     histoTab          = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
 }
コード例 #13
0
        private void ButtonReset_Click(object sender, EventArgs e)
        {
            firstDomainUpDown.SelectedIndex  = 2;
            secondDomainUpDown.SelectedIndex = 2;

            pictureBox1.Image = (Image)imageWindow.getImage().Clone();
            maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);
        }
コード例 #14
0
 public MorphologicalWindow(ImageWindow imageWindow)
 {
     InitializeComponent();
     this.imageWindow  = imageWindow;
     pictureBox1.Image = (Image)imageWindow.getImage().Clone();
     acttualImage      = new Image <Gray, byte>((Bitmap)pictureBox1.Image);
     maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);
     bitmapCopy = (Bitmap)imageWindow.getImage().Clone();
 }
コード例 #15
0
 public StretchWindow(ImageWindow imageWindowRef)
 {
     InitializeComponent();
     imageWindow             = imageWindowRef;
     pictureBox1.Image       = (Image)imageWindowRef.getImage().Clone();
     maxBmpLevel             = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     histoTab                = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
     bottomValueTextBox.Text = bottomTrackBar.Value.ToString();
     upperValueTextBox.Text  = upperTrackBar.Value.ToString();
 }
コード例 #16
0
 //To cloning window
 private ImageWindow(string fp, PictureBox pB, string name)
 {
     InitializeComponent();
     FilePath          = fp;
     Text              = name;
     _image            = (Image)pB.Image.Clone();
     pictureBox1.Image = _image;
     maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     histoTab          = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
 }
コード例 #17
0
        public UOPWindow(ImageWindow imageWindow)
        {
            InitializeComponent();
            this.imageWindow = imageWindow;
            pictureBox.Image = (Image)imageWindow.getImage().Clone();
            maxBmpLevel      = HistogramOperations.MaxBmpLevel(pictureBox.Image);
            histoTab         = HistogramOperations.drawHistogram(chart1, pictureBox.Image, maxBmpLevel);

            initializeUopChart();
            uopCalc();
        }
コード例 #18
0
 public ImageWindow(string fp, string name, MainWindow main)
 {
     _main = main;
     InitializeComponent();
     FilePath          = fp;
     Text              = name;
     _image            = Image.FromFile(fp);
     pictureBox1.Image = _image;
     maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
     histoTab          = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
 }
コード例 #19
0
        public void Thining()
        {
            Image <Gray, Byte> sourceImage = new Image <Gray, byte>((Bitmap)pictureBox1.Image);
            Image <Gray, Byte> dstImage    = new Image <Gray, Byte>(sourceImage.Width, sourceImage.Height);

            XImgprocInvoke.Thinning(sourceImage, dstImage, ThinningTypes.ZhangSuen);

            pictureBox1.Image = dstImage.ToBitmap();
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
        }
コード例 #20
0
        public MedianWindow(ImageWindow imageWindow)
        {
            InitializeComponent();
            this.imageWindow = imageWindow;

            firstDomainUpDown.SelectedIndex  = 2;
            secondDomainUpDown.SelectedIndex = 2;

            pictureBox1.Image = (Image)imageWindow.getImage().Clone();
            maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);
        }
コード例 #21
0
        private void binaryOperation(Image image1, Image image2, OperationType operationType)
        {
            Bitmap bitmapImage1   = new Bitmap(image1);
            Bitmap bitmapImage2   = new Bitmap(image2);
            Bitmap bitmapNewImage = new Bitmap(bitmapImage1.Width, bitmapImage1.Height);

            if (bitmapImage1.Width == bitmapImage2.Width && bitmapImage1.Height == bitmapImage2.Height)
            {
                for (int x = 0; x < bitmapImage1.Width; x++)
                {
                    for (int y = 0; y < bitmapImage1.Height; y++)
                    {
                        Color c1 = bitmapImage1.GetPixel(x, y);
                        Color c2 = bitmapImage2.GetPixel(x, y);
                        int   q  = 0;

                        switch (operationType)
                        {
                        case OperationType.Add:
                            q = (c1.R + c2.R) / 2;
                            break;

                        case OperationType.Sub:
                            q = Math.Abs(c1.R - c2.R);
                            break;

                        case OperationType.Or:
                            q = c1.R | c2.R;
                            break;

                        case OperationType.And:
                            q = c1.R & c2.R;
                            break;

                        case OperationType.Xor:
                            q = c1.R ^ c2.R;
                            break;
                        }

                        bitmapNewImage.SetPixel(x, y, Color.FromArgb(255, q, q, q));
                    }
                }

                pictureBox1.Image = bitmapNewImage;
                HistogramOperations.clearHistogram(chart1);
                maxBmpLevel = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
                histoTab    = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
            }
            else
            {
                MessageBox.Show("Dla operacji dwuargumentowych, należy wybrać obrazy o takich samych wymiarach.", "Nie poprawne wymiary obrazów");
            }
        }
コード例 #22
0
        public void RegionGrowing()
        {
            Image <Bgr, Byte>  img     = new Image <Bgr, byte>((Bitmap)pictureBox1.Image);
            Image <Gray, byte> grayImg = img.Convert <Gray, byte>();
            Image <Gray, byte> binImg  = new Image <Gray, byte>(grayImg.Size);

            CvInvoke.Threshold(grayImg, binImg, 100, 255, ThresholdType.Otsu | ThresholdType.Binary);

            pictureBox1.Image = binImg.ToBitmap();
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
        }
コード例 #23
0
        private void cancelButton_Click(object sender, EventArgs e)
        {
            pictureBox1.Image = (Image)imageWindow.getImage().Clone();
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);

            bottomValueTrackBar.Value = 0;
            upperValueTrackBar.Value  = maxBmpLevel;

            bottomValueLabel.Text = "0";
            upperValueLabel.Text  = maxBmpLevel.ToString();
        }
コード例 #24
0
        private void previewButton_Click(object sender, EventArgs e)
        {
            Bitmap bm            = new Bitmap(imageWindow.getImage());
            Bitmap resultbBitmap = new Bitmap(imageWindow.getImage().Width, imageWindow.getImage().Height);

            for (int x = 1; x < bm.Width - 1; x++)
            {
                for (int y = 1; y < bm.Height - 1; y++)
                {
                    if (uprightRadioButton.Checked)
                    {
                        if (bm.GetPixel(x, y - 1).R == bm.GetPixel(x, y + 1).R)
                        {
                            resultbBitmap.SetPixel(x, y, bm.GetPixel(x, y + 1));
                        }
                        else
                        {
                            resultbBitmap.SetPixel(x, y, bm.GetPixel(x, y));
                        }
                    }
                    else if (horizontallyRadioButton.Checked)
                    {
                        if (bm.GetPixel(x - 1, y).R == bm.GetPixel(x + 1, y).R)
                        {
                            resultbBitmap.SetPixel(x, y, bm.GetPixel(x + 1, y));
                        }
                        else
                        {
                            resultbBitmap.SetPixel(x, y, bm.GetPixel(x, y));
                        }
                    }
                    else if (bothRadioButton.Checked)
                    {
                        if (bm.GetPixel(x, y - 1) == bm.GetPixel(x, y + 1) && bm.GetPixel(x - 1, y) == bm.GetPixel(x + 1, y) && bm.GetPixel(x - 1, y) == bm.GetPixel(x, y - 1))
                        {
                            resultbBitmap.SetPixel(x, y, bm.GetPixel(x, y - 1));
                        }
                        else
                        {
                            resultbBitmap.SetPixel(x, y, bm.GetPixel(x, y));
                        }
                    }
                }
            }

            pictureBox1.Image = resultbBitmap;
            HistogramOperations.clearHistogram(chart1);
            maxBMPLevel = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);
            acceptButton.Enabled = true;
        }
コード例 #25
0
        public TresholdingWindow(ImageWindow imageWindow)
        {
            InitializeComponent();
            this.imageWindow  = imageWindow;
            pictureBox1.Image = (Image)imageWindow.getImage().Clone();
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            histoTab          = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);

            //TrackBars and labels init
            bottomValueTrackBar.Maximum = maxBmpLevel;
            upperValueTrackBar.Maximum  = maxBmpLevel;
            bottomValueLabel.Text       = "0";
            upperValueLabel.Text        = maxBmpLevel.ToString();
        }
コード例 #26
0
        public void negacja()
        {
            Bitmap bitmap = new Bitmap(pictureBox1.Image);

            for (int x = 0; x < bitmap.Width; x++)
            {
                for (int y = 0; y < bitmap.Height; y++)
                {
                    Color currentPixelColor = bitmap.GetPixel(x, y);
                    Color newColor          = Color.FromArgb(maxBmpLevel - currentPixelColor.R, maxBmpLevel - currentPixelColor.G, maxBmpLevel - currentPixelColor.B);
                    bitmap.SetPixel(x, y, newColor);
                }
            }

            pictureBox1.Image = bitmap;
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
        }
コード例 #27
0
        private void ButtonPreview_Click(object sender, EventArgs e)
        {
            Image <Gray, Byte> sourceImage = acttualImage;
            Image <Gray, Byte> dstImage    = new Image <Gray, Byte>(sourceImage.Width, sourceImage.Height);
            Mat structuringElement;

            if (radioButtonFourNeighbors.Checked)
            {
                structuringElement = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Cross, new Size(3, 3), new Point(-1, -1));
            }
            else
            {
                structuringElement = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Rectangle, new Size(3, 3), new Point(-1, -1));
            }

            if (radioButtonErode.Checked)
            {
                CvInvoke.Erode(sourceImage, dstImage, structuringElement, new Point(-1, -1), (int)numericUpDownIterations.Value, Emgu.CV.CvEnum.BorderType.Replicate, new MCvScalar(1));
            }
            else if (radioButtonDilatation.Checked)
            {
                CvInvoke.Dilate(sourceImage, dstImage, structuringElement, new Point(-1, -1), (int)numericUpDownIterations.Value, Emgu.CV.CvEnum.BorderType.Reflect, new MCvScalar(1));
            }
            else if (radioButtonOpen.Checked)
            {
                CvInvoke.MorphologyEx(sourceImage, dstImage, Emgu.CV.CvEnum.MorphOp.Open, structuringElement, new Point(-1, -1), (int)numericUpDownIterations.Value, Emgu.CV.CvEnum.BorderType.Reflect, new MCvScalar(1));
            }
            else if (radioButtonClose.Checked)
            {
                CvInvoke.MorphologyEx(sourceImage, dstImage, Emgu.CV.CvEnum.MorphOp.Close, structuringElement, new Point(-1, -1), (int)numericUpDownIterations.Value, Emgu.CV.CvEnum.BorderType.Reflect, new MCvScalar(1));
            }

            acttualImage      = dstImage;
            pictureBox1.Image = dstImage.ToBitmap();
            maxBMPLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBMPLevel);

            buttonSave.Enabled = true;
        }
コード例 #28
0
        private void maintainingTresholding()
        {
            Bitmap bitmap = new Bitmap(imageWindow.getImage());

            for (int x = 0; x < bitmap.Width; x++)
            {
                for (int y = 0; y < bitmap.Height; y++)
                {
                    Color c = bitmap.GetPixel(x, y);
                    if (c.R <= bottomValueTrackBar.Value || c.R >= upperValueTrackBar.Value)
                    {
                        bitmap.SetPixel(x, y, Color.FromArgb(0, 0, 0));
                        histoTab[0]++;
                    }
                }
            }

            pictureBox1.Image = bitmap;
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
        }
コード例 #29
0
        public GrayscaleReductionWindow(ImageWindow imageWindow)
        {
            InitializeComponent();
            this.imageWindow = imageWindow;
            pictureBox.Image = (Image)imageWindow.getImage().Clone();
            maxBmpLevel      = HistogramOperations.MaxBmpLevel(pictureBox.Image);
            histoTab         = HistogramOperations.drawHistogram(chart1, pictureBox.Image, maxBmpLevel);
            initializeReductionChart(2);

            for (int i = 29; i > 1; --i)
            {
                domainUpDown1.Items.Add(i);
            }

            domainUpDown1.SelectedIndex = 27;

            chartDrawing.ChartAreas[0].AxisX.Maximum = maxBmpLevel;
            chartDrawing.ChartAreas[0].AxisX.Minimum = 0;

            chartDrawing.ChartAreas[0].AxisY.Maximum = maxBmpLevel;
            chartDrawing.ChartAreas[0].AxisY.Minimum = 0;
        }
コード例 #30
0
        private void stretchHisto()
        {
            Bitmap bm = new Bitmap(imageWindow.getImage());

            for (int x = 0; x < bm.Width; x++)
            {
                for (int y = 0; y < bm.Height; y++)
                {
                    Color c = bm.GetPixel(x, y);
                    if (c.R >= bottomTrackBar.Value && c.R < upperTrackBar.Value)
                    {
                        int   q     = (c.R - bottomTrackBar.Value) * (255 / (upperTrackBar.Value - bottomTrackBar.Value));
                        Color color = Color.FromArgb(255, q, q, q);
                        bm.SetPixel(x, y, color);
                    }
                }
            }

            pictureBox1.Image = bm;
            maxBmpLevel       = HistogramOperations.MaxBmpLevel(pictureBox1.Image);
            HistogramOperations.clearHistogram(chart1);
            histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel);
        }