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]); }
public void setNewImage(Image image) { pictureBox1.Image = image; maxBmpLevel = HistogramOperations.MaxBmpLevel(pictureBox1.Image); HistogramOperations.clearHistogram(chart1); histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel); }
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; }
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); }
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); }
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; }
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); }
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]); }
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); }
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); }
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); }
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(); }
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(); }
//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); }
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(); }
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); }
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); }
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); }
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"); } }
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); }
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(); }
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; }
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(); }
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); }
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; }
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); }
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; }
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); }
public void Watershed() { //Source : http://yy-programer.blogspot.com/2012/11/emgucv-image-process-transforming_29.html //Read input image Image <Bgr, Byte> image = new Image <Bgr, Byte>((Bitmap)pictureBox1.Image); //Get the binary image Image <Gray, Byte> binary = image.Convert <Gray, Byte>().ThresholdBinaryInv(new Gray(140), new Gray(255)); Mat closeElement = CvInvoke.GetStructuringElement(Emgu.CV.CvEnum.ElementShape.Ellipse, new Size(5, 5), new Point(2, 2)); binary = binary.MorphologyEx(Emgu.CV.CvEnum.MorphOp.Close, closeElement, new Point(-1, -1), 1, Emgu.CV.CvEnum.BorderType.Default, new MCvScalar()); //Eliminate noise and smaller objects Image <Gray, Byte> foreground = binary.Erode(6); //Identify image pixels without objects Image <Gray, Byte> background = binary.Dilate(6); background._ThresholdBinaryInv(new Gray(1), new Gray(128)); //Create markers image Image <Gray, Byte> markers = background + foreground; //Create watershed segmentation object WatershedSegmenter watershedSegmenter = new WatershedSegmenter(); //Set markers and process watershedSegmenter.SetMakers(markers); Image <Gray, Int32> boundaryImage = watershedSegmenter.Process(image); pictureBox1.Image = watershedSegmenter.GetWatersheds().ToBitmap(); maxBmpLevel = HistogramOperations.MaxBmpLevel(pictureBox1.Image); HistogramOperations.clearHistogram(chart1); histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel); }
//Source: SokolowLineProfile13 public void Turtle() { Bitmap bmp = new Bitmap(pictureBox1.Image); int[,] rtab = new int[bmp.Width, bmp.Height]; int[,] gtab = new int[bmp.Width, bmp.Height]; int[,] btab = new int[bmp.Width, bmp.Height]; int i, j; for (i = 1; i < bmp.Width - 1; i++) { for (j = 1; j < bmp.Height - 1; j++) { rtab[i, j] = bmp.GetPixel(i, j).R; gtab[i, j] = bmp.GetPixel(i, j).G; btab[i, j] = bmp.GetPixel(i, j).B; } } int d = 0; int pami = 0, pamj = 0, ja = 0, ia = 0; int x, y; int[] wynik = new int[bmp.Width * bmp.Height]; int[] droga = new int[bmp.Width * bmp.Height]; for (i = 1; i < bmp.Height - 1; i++) { for (j = 1; j < bmp.Width - 1; j++) { if (rtab[j, i] != 0 || gtab[j, i] != 0 || btab[j, i] != 0) { ja = j; ia = i; pamj = j; pami = i; wynik[bmp.Width * i + j] = maxBmpLevel - 1; goto cont; } } } cont: j = pamj; i = pami - 1; wynik[bmp.Width * i + j] = maxBmpLevel - 1; droga[d] = 1; do { x = j - pamj; y = i - pami; pamj = j; pami = i; d++; if (rtab[j, i] != 0 || gtab[j, i] != 0 || btab[j, i] != 0) { if (x == 0 && y == (-1)) { j--; droga[d] = 2; } if (x == 1 && y == 0) { i--; droga[d] = 1; } if (x == 0 && y == 1) { j++; droga[d] = 0; } if (x == (-1) && y == 0) { i++; droga[d] = 3; } } else { if (x == 0 && y == (-1)) { j++; droga[d] = 0; } if (x == 1 && y == 0) { i++; droga[d] = 3; } if (x == 0 && y == 1) { j--; droga[d] = 2; } if (x == (-1) && y == 0) { i--; droga[d] = 1; } } wynik[bmp.Width * i + j] = maxBmpLevel - 1; }while (j != ja || i != ia); for (i = 0; i < bmp.Height; i++) { for (j = 0; j < bmp.Width; j++) { if (wynik[bmp.Width * i + j] == maxBmpLevel - 1) { rtab[j, i] = maxBmpLevel / 2; gtab[j, i] = 0; btab[j, i] = 0; } } } for (i = 0; i < bmp.Width; i++) { for (j = 0; j < bmp.Height; j++) { bmp.SetPixel(i, j, Color.FromArgb(rtab[i, j], gtab[i, j], btab[i, j])); } } pictureBox1.Image = bmp; maxBmpLevel = HistogramOperations.MaxBmpLevel(pictureBox1.Image); HistogramOperations.clearHistogram(chart1); histoTab = HistogramOperations.drawHistogram(chart1, pictureBox1.Image, maxBmpLevel); }