private void btnHistogramModify_Click(object sender, EventArgs e) { var minimalBrightness = int.Parse(minimalBrightnessHistogram.Text); var maximalBrightness = int.Parse(maximalBrightnessHistogram.Text); pbResultImage.Image = ProcessingMethods.ModifyWithHistogram(pbImage.Image, _histograms, minimalBrightness, maximalBrightness); }
private void btnApplyMedianFilter_Click(object sender, EventArgs e) { if (pbImage.Image != null) { Image result = ProcessingMethods.ApplyMedianFilter(pbImage.Image, mask); pbResultImage.Image = result; } }
private void btnApplyNegative_Click(object sender, EventArgs e) { if (pbImage.Image != null) { Image result = ProcessingMethods.ChangeAsNegative(pbImage.Image); pbResultImage.Image = result; } }
private void btnDecreaseBrigthness_Click(object sender, EventArgs e) { if (pbImage.Image != null) { Image result = ProcessingMethods.ChangeBrightness(pbImage.Image, Convert.ToInt32(brightnessValue.Value), false); pbResultImage.Image = result; } }
private void btnApplyContrast_Click(object sender, EventArgs e) { if (pbImage.Image != null) { byte[] LUT = new byte[256]; chartLUT.Series[0].Points.Clear(); //tworzenie LUT - Look Up Table double a; if (trackBarContrast.Value <= 0) { a = 1.0 + (trackBarContrast.Value / 256.0); } else { a = 256.0 / Math.Pow(2, Math.Log(257 - trackBarContrast.Value, 2)); } for (int i = 0; i < 256; i++) { if ((a * (i - 127) + 127) > 255) { LUT[i] = 255; } else if ((a * (i - 127) + 127) < 0) { LUT[i] = 0; } else { LUT[i] = (byte)(a * (i - 127) + 127); } chartLUT.Series[0].Points.Add(new DataPoint(i, LUT[i])); } Image result = ProcessingMethods.ChangeContrast(pbImage.Image, LUT); pbResultImage.Image = result; } }
private void button2_Click(object sender, EventArgs e) { string maskLocal = ""; string[] lines = new string[1]; LoadLinearMask(ref maskLocal, ref lines); lines = tbMaskView.Text.Split('\n'); List <string> maskValues = new List <string>(); foreach (string line in lines) { if (line != "" && line != "\r") { string tmp = line.Replace("\r", ""); maskValues.Add(tmp.Replace("\t", "")); } } maskLinearFilter = new int[maskValues.Count, maskValues.Count]; for (int i = 0; i < maskValues.Count; i++) { int index = 0; for (int j = 0; j < maskValues.Count; j++) { maskLinearFilter[i, j] = GetNextValue(ref index, maskValues[i]); index++; } } if (pbImage.Image != null) { Image result = ProcessingMethods.ApplyMask(pbImage.Image, maskLinearFilter); pbResultImage.Image = result; } }
private void btnOperator_Click(object sender, EventArgs e) { pbResultImage.Image = ProcessingMethods.ApplyRosenfeld(pbImage.Image, int.Parse(valueRosenfeld.Text)); }